コード例 #1
0
 /**
  * Returns a composed {@link BiCharToFloatFunction} 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
  * char} 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 BiCharToFloatFunction} 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 char}.
  */
 @Nonnull
 default BiCharToFloatFunction composeFromChar(
     @Nonnull final CharPredicate before1, @Nonnull final CharPredicate before2) {
   Objects.requireNonNull(before1);
   Objects.requireNonNull(before2);
   return (value1, value2) -> applyAsFloat(before1.test(value1), before2.test(value2));
 }
コード例 #2
0
 /**
  * Creates a {@link ObjCharPredicate} which uses the {@code second} parameter of this one as
  * argument for the given {@link CharPredicate}.
  *
  * @param <T> The type of the first argument to the predicate
  * @param predicate The predicate which accepts the {@code second} parameter of this one
  * @return Creates a {@code ObjCharPredicate} which uses the {@code second} parameter of this one
  *     as argument for the given {@code CharPredicate}.
  * @throws NullPointerException If given argument is {@code null}
  */
 @Nonnull
 static <T> ObjCharPredicate<T> onlySecond(@Nonnull final CharPredicate predicate) {
   Objects.requireNonNull(predicate);
   return (t, value) -> predicate.test(value);
 }
コード例 #3
0
 /**
  * Returns a composed {@link ObjBiBytePredicate} 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 ObjBiBytePredicate} 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}.
  */
 @Nonnull
 default ObjBiBytePredicate<T> andThenToBoolean(@Nonnull final CharPredicate after) {
   Objects.requireNonNull(after);
   return (t, value1, value2) -> after.test(applyAsChar(t, value1, value2));
 }
コード例 #4
0
ファイル: CharSupplier.java プロジェクト: gridtec/lambda4j
 /**
  * Returns a composed {@link BooleanSupplier2} that first applies this supplier 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 supplier to an operation
  * returning {@code boolean}.
  *
  * @param after The predicate to apply after this supplier is applied
  * @return A composed {@code BooleanSupplier2} that first applies this supplier 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}.
  */
 @Nonnull
 default BooleanSupplier2 andThenToBoolean(@Nonnull final CharPredicate after) {
   Objects.requireNonNull(after);
   return () -> after.test(getAsChar());
 }