Java Code Examples for java.util.EnumSet#forEach()
The following examples show how to use
java.util.EnumSet#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: TestNNAnalyticsBase.java From NNAnalytics with 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 File: AttrCompletionItem.java From NBANDROID-V2 with 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 File: WCAFilteredClusters.java From ipst with 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 File: WCAFilteredClusters.java From ipst with 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 File: TestMutuallyExclusivePlatformPredicates.java From TencentKona-8 with 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 File: TestMutuallyExclusivePlatformPredicates.java From jdk8u60 with 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 File: TestMutuallyExclusivePlatformPredicates.java From openjdk-jdk8u with 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 File: TestMutuallyExclusivePlatformPredicates.java From openjdk-jdk8u-backup with 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 File: TestMutuallyExclusivePlatformPredicates.java From openjdk-jdk9 with 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 File: MethodGenerator.java From openjdk-jdk9 with 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 File: TestMutuallyExclusivePlatformPredicates.java From hottub with 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 File: EnumSets.java From tutorials with 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 File: VaadinConnectTypeConversionEndpoints.java From flow with 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 File: SimpleOperationTracker.java From ambry with 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); }