Java Code Examples for java.util.SortedSet#forEach()
The following examples show how to use
java.util.SortedSet#forEach() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OwsEncoderv110.java From arctic-sea with Apache License 2.0 | 6 votes |
private void encodeOwsDCP(OwsDCP dcp, DCP xdcp) { if (dcp.isHTTP()) { HTTP xhttp = xdcp.addNewHTTP(); OwsHttp http = dcp.asHTTP(); SortedSet<OwsRequestMethod> requestMethods = http.getRequestMethods(); requestMethods.forEach(method -> { RequestMethodType xmethod; switch (method.getHttpMethod()) { case HTTPMethods.GET: xmethod = xhttp.addNewGet(); break; case HTTPMethods.POST: xmethod = xhttp.addNewPost(); break; default: return; } encodeOnlineResource(method, xmethod); method.getConstraints().forEach(x -> encodeOwsDomain(x, xmethod.addNewConstraint())); }); } }
Example 2
Source File: NodeMap.java From LuckPerms with MIT License | 6 votes |
public void forEach(QueryOptions filter, Consumer<? super Node> consumer) { for (Map.Entry<ImmutableContextSet, SortedSet<Node>> e : this.map.entrySet()) { if (!filter.satisfies(e.getKey(), defaultSatisfyMode())) { continue; } if (normalNodesExcludeTest(filter, e.getKey())) { if (inheritanceNodesIncludeTest(filter, e.getKey())) { // only copy inheritance nodes. SortedSet<InheritanceNode> inheritanceNodes = this.inheritanceMap.get(e.getKey()); if (inheritanceNodes != null) { inheritanceNodes.forEach(consumer); } } } else { e.getValue().forEach(consumer); } } }
Example 3
Source File: TelemetryConfigViewCommand.java From onos with Apache License 2.0 | 6 votes |
@Override protected void doExecute() { TelemetryConfigService service = get(TelemetryConfigService.class); TelemetryConfig config = service.getConfig(configName); if (config == null) { print(NO_ELEMENT); return; } SortedSet<String> keys = new TreeSet<>(config.properties().keySet()); keys.forEach(k -> { print(FORMAT, k, config.properties().get(k)); }); }
Example 4
Source File: StandardServiceFacade.java From nifi-registry with Apache License 2.0 | 5 votes |
@Override public List<ExtensionRepoExtensionMetadata> getExtensionRepoExtensions(final URI baseUri, final String bucketName, final String groupId, final String artifactId, final String version) { final Bucket bucket = registryService.getBucketByName(bucketName); authorizeBucketAccess(RequestAction.READ, bucket.getIdentifier()); final BundleVersion bundleVersion = extensionService.getBundleVersion(bucket.getIdentifier(), groupId, artifactId, version); final SortedSet<ExtensionMetadata> extensions = extensionService.getExtensionMetadata(bundleVersion); final List<ExtensionRepoExtensionMetadata> extensionRepoExtensions = new ArrayList<>(extensions.size()); extensions.forEach(e -> extensionRepoExtensions.add(new ExtensionRepoExtensionMetadata(e))); linkService.populateFullLinks(extensionRepoExtensions, baseUri); return extensionRepoExtensions; }
Example 5
Source File: CacheConfiguration.java From ServiceCutter with Apache License 2.0 | 5 votes |
@PreDestroy public void destroy() { log.info("Remove Cache Manager metrics"); SortedSet<String> names = metricRegistry.getNames(); names.forEach(metricRegistry::remove); log.info("Closing Cache Manager"); cacheManager.shutdown(); }
Example 6
Source File: CollectionHelpers.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * @param sourceListing * @return */ public static Vector<String> vectorSortedUniqueMembers(String[][] sourceListing){ SortedSet<String> treeSet = new TreeSet<>(); for (String[] sourceListing1 : sourceListing) { treeSet.addAll(Arrays.asList(sourceListing1)); } Vector<String> retval = new Vector<>(); treeSet.forEach((s) -> { retval.add( s ); }); return retval; }
Example 7
Source File: TestMicroservice.java From msf4j with Apache License 2.0 | 5 votes |
@Path("/sortedSetQueryParam") @GET public String testSortedSetQueryParam(@QueryParam("id") SortedSet<Integer> ids) { StringBuilder response = new StringBuilder(); ids.forEach(id -> response.append(id).append(",")); if (response.length() > 0) { response.setLength(response.length() - 1); } return response.toString(); }
Example 8
Source File: FlowTracer.java From batfish with Apache License 2.0 | 5 votes |
private void processOutgoingInterfaceEdges( String outgoingInterface, Ip nextHopIp, SortedSet<NodeInterfacePair> neighborIfaces) { checkArgument(!neighborIfaces.isEmpty(), "No neighbor interfaces."); checkState( _steps.get(_steps.size() - 1) instanceof ExitOutputIfaceStep, "ExitOutputIfaceStep needs to be added before calling this function"); Ip arpIp = Route.UNSET_ROUTE_NEXT_HOP_IP.equals(nextHopIp) ? _currentFlow.getDstIp() : nextHopIp; SortedSet<NodeInterfacePair> interfacesThatReplyToArp = neighborIfaces.stream() .filter( iface -> _tracerouteContext.repliesToArp( iface.getHostname(), iface.getInterface(), arpIp)) .collect(ImmutableSortedSet.toImmutableSortedSet(Ordering.natural())); if (interfacesThatReplyToArp.isEmpty()) { FlowDisposition disposition = _tracerouteContext.computeDisposition( _currentNode.getName(), outgoingInterface, _currentFlow.getDstIp()); buildArpFailureTrace(outgoingInterface, arpIp, disposition); return; } Hop hop = new Hop(_currentNode, _steps); _hops.add(hop); NodeInterfacePair exitIface = NodeInterfacePair.of(_currentNode.getName(), outgoingInterface); interfacesThatReplyToArp.forEach( enterIface -> forkTracerFollowEdge(exitIface, enterIface).processHop()); }
Example 9
Source File: Bmv2PreGroupTranslatorImpl.java From onos with Apache License 2.0 | 5 votes |
/** * Builds a port map string composing of 1 and 0s. * BMv2 API reads a port map from most significant to least significant char. * Index of 1s indicates port numbers. * For example, if port numbers are 4,3 and 1, the generated port map string looks like 11010. * * @param outPorts set of output port numbers * @return port map string */ private static String buildPortMap(Set<PortNumber> outPorts) { //Sorts port numbers in descending order SortedSet<PortNumber> outPortsSorted = new TreeSet<>((o1, o2) -> (int) (o2.toLong() - o1.toLong())); outPortsSorted.addAll(outPorts); PortNumber biggestPort = outPortsSorted.iterator().next(); int portMapSize = (int) biggestPort.toLong() + 1; //init and fill port map with zero characters char[] portMap = new char[portMapSize]; Arrays.fill(portMap, '0'); //fill in the ports with 1 outPortsSorted.forEach(portNumber -> portMap[portMapSize - (int) portNumber.toLong() - 1] = '1'); return String.valueOf(portMap); }
Example 10
Source File: SelectionTable.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
@EventListener public void onRemoveSelected(RemoveSelectedEvent event) { SortedSet<Integer> indices = new TreeSet<>(Collections.reverseOrder()); indices.addAll(getSelectionModel().getSelectedIndices()); LOG.trace("Removing {} items", indices.size()); indices.forEach(i -> getItems().remove(i.intValue()).invalidate()); requestFocus(); }
Example 11
Source File: LeaseItem_IntegTest.java From estatio with Apache License 2.0 | 5 votes |
@Test public void happyCase() throws Exception { // given LeaseItem leaseItem = lease.findItem(LeaseItemType.SERVICE_CHARGE, VT.ld(2010, 7, 15), VT.bi(1)); assertThat(leaseItem).isNotNull(); assertThat(leaseItem.getInvoicingFrequency()).isEqualTo(InvoicingFrequency.QUARTERLY_IN_ADVANCE); final SortedSet<LeaseTerm> terms = leaseItem.getTerms(); terms.forEach(leaseTerm -> assertThat(leaseTerm.getInvoiceItems()).isEmpty()); // when wrap(leaseItem).changeInvoicingFrequency(InvoicingFrequency.MONTHLY_IN_ADVANCE); // then assertThat(leaseItem.getInvoicingFrequency()).isEqualTo(InvoicingFrequency.MONTHLY_IN_ADVANCE); }
Example 12
Source File: KafkaPartitionMetricSampleAggregator.java From cruise-control with BSD 2-Clause "Simplified" License | 4 votes |
private static SortedSet<Long> windowIndicesToWindows(SortedSet<Long> original, long windowMs) { SortedSet<Long> result = new TreeSet<>(Collections.reverseOrder()); original.forEach(idx -> result.add(idx * windowMs)); return result; }
Example 13
Source File: MetricSampleAggregator.java From cruise-control with BSD 2-Clause "Simplified" License | 4 votes |
private List<Long> toWindows(SortedSet<Long> windowIndices) { List<Long> windows = new ArrayList<>(windowIndices.size()); windowIndices.forEach(i -> windows.add(i * _windowMs)); return windows; }