List of usage examples for java.util.function IntPredicate test
boolean test(int value);
From source file:at.gridtec.lambda4j.predicate.tri.obj.BiObjIntPredicate.java
/** * Creates a {@link BiObjIntPredicate} which uses the {@code third} parameter of this one as argument for the given * {@link IntPredicate}.// w ww . j a v a 2 s . c o m * * @param <T> The type of the first argument to the predicate * @param <U> The type of the second argument to the predicate * @param predicate The predicate which accepts the {@code third} parameter of this one * @return Creates a {@code BiObjIntPredicate} which uses the {@code third} parameter of this one as argument for * the given {@code IntPredicate}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T, U> BiObjIntPredicate<T, U> onlyThird(@Nonnull final IntPredicate predicate) { Objects.requireNonNull(predicate); return (t, u, value) -> predicate.test(value); }
From source file:at.gridtec.lambda4j.function.bi.to.ToIntBiFunction2.java
/** * Returns a composed {@link BiPredicate2} that first applies this function to its input, and then applies the * {@code after} predicate 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 transform this * primitive function to an operation returning {@code boolean}. * * @param after The predicate to apply after this function is applied * @return A composed {@code BiPredicate2} that first applies this function to its input, and then applies the * {@code after} predicate to the result. * @throws NullPointerException If given argument is {@code null} * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code * boolean}./*from www . j a v a 2 s.c om*/ */ @Nonnull default BiPredicate2<T, U> andThenToBoolean(@Nonnull final IntPredicate after) { Objects.requireNonNull(after); return (t, u) -> after.test(applyAsInt(t, u)); }
From source file:at.gridtec.lambda4j.function.tri.to.ToIntTriFunction.java
/** * Returns a composed {@link TriPredicate} that first applies this function to its input, and then applies the * {@code after} predicate 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 transform this * primitive function to an operation returning {@code boolean}. * * @param after The predicate to apply after this function is applied * @return A composed {@code TriPredicate} that first applies this function to its input, and then applies the * {@code after} predicate to the result. * @throws NullPointerException If given argument is {@code null} * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code * boolean}./* w w w.j a va2s . c o m*/ */ @Nonnull default TriPredicate<T, U, V> andThenToBoolean(@Nonnull final IntPredicate after) { Objects.requireNonNull(after); return (t, u, v) -> after.test(applyAsInt(t, u, v)); }
From source file:at.gridtec.lambda4j.function.bi.BiBooleanFunction.java
/** * Returns a composed {@link BiIntFunction} 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 BiIntFunction} that first applies the {@code before} predicates to its input, and then * applies this function to the result.// w ww .jav a 2 s. c o m * @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 BiIntFunction<R> composeFromInt(@Nonnull final IntPredicate before1, @Nonnull final IntPredicate before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> apply(before1.test(value1), before2.test(value2)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjBooleanFunction.java
/** * Returns a composed {@link BiIntFunction} that first applies the {@code before} functions 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 function to apply before this function is applied * @param before2 The second predicate to apply before this function is applied * @return A composed {@code BiIntFunction} that first applies the {@code before} functions to its input, and then * applies this function to the result./* w ww . j a v a2s. c o m*/ * @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 BiIntFunction<R> composeFromInt(@Nonnull final IntFunction<? extends T> before1, @Nonnull final IntPredicate before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> apply(before1.apply(value1), before2.test(value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiBooleanToIntFunction.java
/** * Returns a composed {@link BooleanBinaryOperator} that first applies this function to its input, and then applies * the {@code after} predicate 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 transform * this primitive function to an operation returning {@code boolean}. * * @param after The predicate to apply after this function is applied * @return A composed {@code BooleanBinaryOperator} that first applies this function to its input, and then applies * the {@code after} predicate to the result. * @throws NullPointerException If given argument is {@code null} * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code * boolean}.// w ww .j a va 2s . c o m */ @Nonnull default BooleanBinaryOperator andThenToBoolean(@Nonnull final IntPredicate after) { Objects.requireNonNull(after); return (value1, value2) -> after.test(applyAsInt(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiByteToIntFunction.java
/** * Returns a composed {@link BiBytePredicate} that first applies this function to its input, and then applies the * {@code after} predicate 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 transform this * primitive function to an operation returning {@code boolean}. * * @param after The predicate to apply after this function is applied * @return A composed {@code BiBytePredicate} that first applies this function to its input, and then applies the * {@code after} predicate to the result. * @throws NullPointerException If given argument is {@code null} * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code * boolean}./*from ww w . j a v a 2 s . co m*/ */ @Nonnull default BiBytePredicate andThenToBoolean(@Nonnull final IntPredicate after) { Objects.requireNonNull(after); return (value1, value2) -> after.test(applyAsInt(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiCharToIntFunction.java
/** * Returns a composed {@link BiCharPredicate} that first applies this function to its input, and then applies the * {@code after} predicate 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 transform this * primitive function to an operation returning {@code boolean}. * * @param after The predicate to apply after this function is applied * @return A composed {@code BiCharPredicate} that first applies this function to its input, and then applies the * {@code after} predicate to the result. * @throws NullPointerException If given argument is {@code null} * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code * boolean}./*from w w w. ja v a2 s. com*/ */ @Nonnull default BiCharPredicate andThenToBoolean(@Nonnull final IntPredicate after) { Objects.requireNonNull(after); return (value1, value2) -> after.test(applyAsInt(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiFloatToIntFunction.java
/** * Returns a composed {@link BiFloatPredicate} that first applies this function to its input, and then applies the * {@code after} predicate 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 transform this * primitive function to an operation returning {@code boolean}. * * @param after The predicate to apply after this function is applied * @return A composed {@code BiFloatPredicate} that first applies this function to its input, and then applies the * {@code after} predicate to the result. * @throws NullPointerException If given argument is {@code null} * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code * boolean}.//from w w w . j a va 2 s. c o m */ @Nonnull default BiFloatPredicate andThenToBoolean(@Nonnull final IntPredicate after) { Objects.requireNonNull(after); return (value1, value2) -> after.test(applyAsInt(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiShortToIntFunction.java
/** * Returns a composed {@link BiShortPredicate} that first applies this function to its input, and then applies the * {@code after} predicate 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 transform this * primitive function to an operation returning {@code boolean}. * * @param after The predicate to apply after this function is applied * @return A composed {@code BiShortPredicate} that first applies this function to its input, and then applies the * {@code after} predicate to the result. * @throws NullPointerException If given argument is {@code null} * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code * boolean}./*from w ww. j a v a2 s .co m*/ */ @Nonnull default BiShortPredicate andThenToBoolean(@Nonnull final IntPredicate after) { Objects.requireNonNull(after); return (value1, value2) -> after.test(applyAsInt(value1, value2)); }