int streamMethod(final String data, final IntPredicate predicate) { if (data.chars().anyMatch(predicate)) { doThrow(); } return data.length(); }
@Override public boolean hasNext() { return IntStream.range(0, tensor.dimensions.length).anyMatch(i -> currentPosition[i] < limits[1][i]); }
/** * Check if set a contains any element in set b. * @param a the first set. * @param b the second set. * @return true if a contains at least one of the element in b. false otherwise; */ public static boolean containsAny(Set<Integer> a, Set<Integer> b) { return b.stream().mapToInt(i -> i).anyMatch(a::contains); }
private boolean containsOneOrMoreWhitespaces(CharSequence actual) { return actual.chars().anyMatch(Character::isWhitespace); }
// avoid this at all costs int streamParallelMethod(final String data, IntPredicate predicate) { if (data.chars().parallel().anyMatch(predicate)) { doThrow(); } return data.length(); }
@Override public Boolean execute() { try (final IntStream stream = buildPrevious()) { return stream.anyMatch(predicate); } } }
private boolean containsOneOrMoreWhitespaces(CharSequence actual) { return actual.chars().anyMatch(Character::isWhitespace); }
private boolean checkArea() { return client.getMapRegions() != null && Arrays.stream(client.getMapRegions()) .filter(x -> Arrays.stream(HERBIBOAR_REGIONS).anyMatch(y -> y == x)) .toArray().length > 0; }
default boolean anyMatch(IntPipeline pipeline, IntPredicate predicate) { requireNonNull(pipeline); requireNonNull(predicate); return optimize(pipeline).getAsIntStream().anyMatch(predicate); }
@Override public boolean anyMatch(IntPredicate predicate) { return finallyClose(() -> stream().anyMatch(predicate)); }
/** * Method to update on-the-fly "Include All Rows" checkbox whether "Cumulative sum" or "Cumulative average" values are configured in the Aggregation table. * * @param aggregationTable the aggregation table to check the entries * @param allRowsButton the checkbox to update * @param forceUpdate if an update must be done */ void updateAllRowsCheckbox( TableView aggregationTable, Button allRowsButton, boolean forceUpdate ) { boolean isCumulativeSelected = IntStream.range( 0, aggregationTable.nrNonEmpty() ) .map( row -> GroupByMeta.getType( aggregationTable.getNonEmpty( row ).getText( AGGREGATION_TABLE_TYPE_INDEX ) ) ) .anyMatch( pred -> pred == GroupByMeta.TYPE_GROUP_CUMULATIVE_SUM || pred == GroupByMeta.TYPE_GROUP_CUMULATIVE_AVERAGE ); allRowsButton.setEnabled( !isCumulativeSelected ); if ( isCumulativeSelected ) { allRowsButton.setSelection( true ); if ( forceUpdate ) { backupChanged = true; } } } }
if (post.get("key-size", null) != null) { int finalKeyLength = post.get("key-size", 0); if (!IntStream.of(allowedKeySizesRSA).anyMatch(x -> x == finalKeyLength)) { throw new APIException(400, "Invalid key size."); keySize = 8192; if (!IntStream.of(allowedKeySizesRSA).anyMatch(x -> x == keySize)) { throw new APIException(400, "Invalid key length.");
private boolean findCondition() { IntSet tailNodes = new IntHashSet(program.basicBlockCount()); for (int tailCandidate : cfg.incomingEdges(head)) { if (nodes.contains(tailCandidate)) { tailNodes.add(tailCandidate); } } bodyStart = dom.commonDominatorOf(tailNodes.toArray()); int candidate = bodyStart; while (bodyStart != head) { int currentCandidate = candidate; if (Arrays.stream(exits.toArray()).anyMatch(exit -> dom.dominates(currentCandidate, exit))) { break; } bodyStart = candidate; candidate = dom.immediateDominatorOf(candidate); } return candidate != bodyStart; }
int[] array = {3, 2, 5, 4}; if (Arrays.stream(array).anyMatch(x -> x == 3)) { System.out.println("The array contains 3"); }
public static boolean containsHanScript(String s) { return s.codePoints().anyMatch( codepoint -> Character.UnicodeScript.of(codepoint) == Character.UnicodeScript.HAN); }
public static int[] intersection(int[] a, int[] b) { return Arrays.stream(a) .filter(x -> Arrays.stream(b) .anyMatch(y -> y == x) ) .toArray(); }