Java Code Examples for java.util.EnumSet#forEach()
The following examples show how to use
java.util.EnumSet#forEach() .
These examples are extracted from open source projects.
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 Project: NNAnalytics File: TestNNAnalyticsBase.java License: Apache License 2.0 | 6 votes |
@Test public void testEndpoints() throws IOException { EnumSet<Endpoint> clone = UNSECURED_ENDPOINTS.clone(); clone.remove(Endpoint.login); clone.remove(Endpoint.logout); clone.remove(Endpoint.credentials); clone.forEach( x -> { String url = "http://localhost:4567/" + x.name(); System.out.println("Calling: " + url); HttpGet get = new HttpGet(url); HttpResponse res = null; try { res = client.execute(hostPort, get); IOUtils.readLines(res.getEntity().getContent()).clear(); } catch (IOException e) { fail(); } assertThat(res.getStatusLine().getStatusCode(), is(200)); }); }
Example 2
Source Project: NBANDROID-V2 File: AttrCompletionItem.java License: Apache License 2.0 | 6 votes |
public AttrCompletionItem(AndroidStyleable styleable, AndroidStyleableAttr attr, String prefix) { if (prefix == null) { prefix = ""; } prefix = prefix.replace("xmlns:", ""); this.styleable = styleable; this.attr = attr; this.prefix = prefix; completionText = prefix + ":" + attr.getName(); classNameText = ""; EnumSet<AndroidStyleableAttrType> attrTypes = attr.getAttrTypes(); List<String> types = new ArrayList<>(); attrTypes.forEach(t -> { types.add(t.toString()); }); typeNames = String.join(", ", types); lowerCasecompletionText = completionText.toLowerCase(); if (attr.getName() != null) { lowerCaseSimpleCompletionText = attr.getName().toLowerCase(); } else { lowerCaseSimpleCompletionText = ""; } }
Example 3
Source Project: ipst File: WCAFilteredClusters.java License: Mozilla Public License 2.0 | 6 votes |
public void removeClusters(String contingencyId, EnumSet<WCAClusterNum> clustersNums, WCAClusterOrigin flag) { Objects.requireNonNull(contingencyId, "contingency id is null"); Objects.requireNonNull(clustersNums, "clustersNums is null"); LOGGER.info("Network {}, contingency {}: removing clusters {} for {}", networkId, contingencyId, clustersNums.toString(), flag); if (contingencyClusters.containsKey(contingencyId)) { // remove clusters from the list of the contingency EnumSet<WCAClusterNum> clusters = contingencyClusters.get(contingencyId); clustersNums.forEach(clusterNum -> clusters.remove(clusterNum)); contingencyClusters.put(contingencyId, clusters); if (flag != null) { // add flag to the list of the contingency EnumSet<WCAClusterOrigin> flags = EnumSet.noneOf(WCAClusterOrigin.class); if (contingencyFlags.containsKey(contingencyId)) { flags = contingencyFlags.get(contingencyId); } flags.add(flag); contingencyFlags.put(contingencyId, flags); } } else { LOGGER.warn("Network {}, contingency {}: no possible clusters", networkId, contingencyId); } }
Example 4
Source Project: ipst File: WCAFilteredClusters.java License: Mozilla Public License 2.0 | 6 votes |
public void addClusters(String contingencyId, EnumSet<WCAClusterNum> clustersNums, WCAClusterOrigin flag) { Objects.requireNonNull(contingencyId, "contingency id is null"); Objects.requireNonNull(clustersNums, "clustersNums is null"); LOGGER.info("Network {}, contingency {}: adding clusters {} for {}", networkId, contingencyId, clustersNums.toString(), flag); if (contingencyClusters.containsKey(contingencyId)) { // add clusters to the list of the contingency EnumSet<WCAClusterNum> clusters = contingencyClusters.get(contingencyId); clustersNums.forEach(clusterNum -> clusters.add(clusterNum)); contingencyClusters.put(contingencyId, clusters); if (flag != null) { // add flag to the list of the contingency EnumSet<WCAClusterOrigin> flags = EnumSet.noneOf(WCAClusterOrigin.class); if (contingencyFlags.containsKey(contingencyId)) { flags = contingencyFlags.get(contingencyId); } flags.add(flag); contingencyFlags.put(contingencyId, flags); } } else { LOGGER.warn("Network {}, contingency {}: no possible clusters", networkId, contingencyId); } }
Example 5
Source Project: TencentKona-8 File: TestMutuallyExclusivePlatformPredicates.java License: GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) { EnumSet<MethodGroup> notIgnoredMethodGroups = EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED)); notIgnoredMethodGroups.forEach( TestMutuallyExclusivePlatformPredicates::verifyPredicates); TestMutuallyExclusivePlatformPredicates.verifyCoverage(); }
Example 6
Source Project: jdk8u60 File: TestMutuallyExclusivePlatformPredicates.java License: GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) { EnumSet<MethodGroup> notIgnoredMethodGroups = EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED)); notIgnoredMethodGroups.forEach( TestMutuallyExclusivePlatformPredicates::verifyPredicates); TestMutuallyExclusivePlatformPredicates.verifyCoverage(); }
Example 7
Source Project: openjdk-jdk8u File: TestMutuallyExclusivePlatformPredicates.java License: GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) { EnumSet<MethodGroup> notIgnoredMethodGroups = EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED)); notIgnoredMethodGroups.forEach( TestMutuallyExclusivePlatformPredicates::verifyPredicates); TestMutuallyExclusivePlatformPredicates.verifyCoverage(); }
Example 8
Source Project: openjdk-jdk8u-backup File: TestMutuallyExclusivePlatformPredicates.java License: GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) { EnumSet<MethodGroup> notIgnoredMethodGroups = EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED)); notIgnoredMethodGroups.forEach( TestMutuallyExclusivePlatformPredicates::verifyPredicates); TestMutuallyExclusivePlatformPredicates.verifyCoverage(); }
Example 9
Source Project: openjdk-jdk9 File: TestMutuallyExclusivePlatformPredicates.java License: GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) { EnumSet<MethodGroup> notIgnoredMethodGroups = EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED)); notIgnoredMethodGroups.forEach( TestMutuallyExclusivePlatformPredicates::verifyPredicates); TestMutuallyExclusivePlatformPredicates.verifyCoverage(); }
Example 10
Source Project: openjdk-jdk9 File: MethodGenerator.java License: GNU General Public License v2.0 | 5 votes |
/** * Generates triples from the given enum sets * for each of the method elements * * @param classSet set of allowed elements for class * @param methodSet set of allowed elements for method * @param signSet set of allowed elements for signature * @param <E> type of generated triples * @return list of triples */ private static <E extends Enum<E>> List<Combination<E>> generate( EnumSet<E> classSet, EnumSet<E> methodSet, EnumSet<E> signSet) { List<Combination<E>> list = new ArrayList<>(); classSet.forEach(clsElement -> methodSet.forEach(methodElement -> signSet.forEach(signElement -> list.add(new Combination<>(clsElement, methodElement, signElement)) ) ) ); return list; }
Example 11
Source Project: hottub File: TestMutuallyExclusivePlatformPredicates.java License: GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) { EnumSet<MethodGroup> notIgnoredMethodGroups = EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED)); notIgnoredMethodGroups.forEach( TestMutuallyExclusivePlatformPredicates::verifyPredicates); TestMutuallyExclusivePlatformPredicates.verifyCoverage(); }
Example 12
Source Project: tutorials File: EnumSets.java License: MIT License | 5 votes |
public static void main(String[] args) { EnumSet<Color> allColors = EnumSet.allOf(Color.class); System.out.println(allColors); EnumSet<Color> noColors = EnumSet.noneOf(Color.class); System.out.println(noColors); EnumSet<Color> blackAndWhite = EnumSet.of(Color.BLACK, Color.WHITE); System.out.println(blackAndWhite); EnumSet<Color> noBlackOrWhite = EnumSet.complementOf(blackAndWhite); System.out.println(noBlackOrWhite); EnumSet<Color> range = EnumSet.range(Color.YELLOW, Color.BLUE); System.out.println(range); EnumSet<Color> blackAndWhiteCopy = EnumSet.copyOf(EnumSet.of(Color.BLACK, Color.WHITE)); System.out.println(blackAndWhiteCopy); List<Color> colorsList = new ArrayList<>(); colorsList.add(Color.RED); EnumSet<Color> listCopy = EnumSet.copyOf(colorsList); System.out.println(listCopy); EnumSet<Color> set = EnumSet.noneOf(Color.class); set.add(Color.RED); set.add(Color.YELLOW); set.contains(Color.RED); set.forEach(System.out::println); set.remove(Color.RED); }
Example 13
Source Project: flow File: VaadinConnectTypeConversionEndpoints.java License: Apache License 2.0 | 4 votes |
public EnumSet<TestEnum> getNextValueEnumSet(EnumSet<TestEnum> value) { EnumSet<TestEnum> enumSet = EnumSet.noneOf(TestEnum.class); value.forEach(testEnum -> enumSet .add(TestEnum.getTestEnum(testEnum.getValue() + 1))); return enumSet; }
Example 14
Source Project: ambry File: SimpleOperationTracker.java License: Apache License 2.0 | 2 votes |
/** * Get eligible replicas by states for given partition from specified data center. If dcName is null, it gets all eligible * replicas from all data centers. * @param partitionId the {@link PartitionId} that replicas belong to. * @param dcName the name of data center from which the replicas should come from. This can be {@code null}. * @param states a set of {@link ReplicaState}(s) that replicas should match. * @return a list of eligible replicas that are in specified states. */ private List<ReplicaId> getEligibleReplicas(PartitionId partitionId, String dcName, EnumSet<ReplicaState> states) { Set<ReplicaId> eligibleReplicas = new HashSet<>(); states.forEach(state -> eligibleReplicas.addAll(partitionId.getReplicaIdsByState(state, dcName))); return new ArrayList<>(eligibleReplicas); }