/** * Returns a composed {@link BiIntToFloatFunction} that first applies the {@code before} * predicates to its input, and then applies this function to the result. If evaluation of either * operation throws an exception, it is relayed to the caller of the composed operation. This * method is just convenience, to provide the ability to execute an operation which accepts {@code * int} input, before this primitive function is executed. * * @param before1 The first predicate to apply before this function is applied * @param before2 The second predicate to apply before this function is applied * @return A composed {@code BiIntToFloatFunction} that first applies the {@code before} * predicates to its input, and then applies this function to the result. * @throws NullPointerException If given argument is {@code null} * @implSpec The input argument of this method is a able to handle primitive values. In this case * this is {@code int}. */ @Nonnull default BiIntToFloatFunction composeFromInt( @Nonnull final IntPredicate before1, @Nonnull final IntPredicate before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> applyAsFloat(before1.test(value1), before2.test(value2)); }
private void selectNuclideFilter(String key) { IntPredicate p = key.matches(" *") ? n -> true : _nuclideFilters.get(key); if (p == null) { p = createNuclideFilter(key); _nuclideFilters.put(key, p); _nuclideFilterNames.add(key); } final IntPredicate predicate = p; _currentNuclideFilterProperty.set(inventory -> predicate.test(inventory.nucid)); }
public int leesTotGeldig(IntPredicate controle, String boodschap) { System.out.println(boodschap); int getal = scanner.nextInt(); while (!controle.test(getal)) { System.out.println(boodschap); getal = scanner.nextInt(); } return getal; }
@Override public int lastIndexOf(IntPredicate predicate, int fromIndex) { Assert.notNull(predicate, "'predicate' must not be null"); int i = Math.min(fromIndex, this.writePosition - 1); for (; i >= 0; i--) { byte b = this.byteBuffer.get(i); if (predicate.test(b)) { return i; } } return -1; }
@Override public int indexOf(IntPredicate predicate, int fromIndex) { Assert.notNull(predicate, "'predicate' must not be null"); if (fromIndex < 0) { fromIndex = 0; } else if (fromIndex >= this.writePosition) { return -1; } for (int i = fromIndex; i < this.writePosition; i++) { byte b = this.byteBuffer.get(i); if (predicate.test(b)) { return i; } } return -1; }