Пример #1
0
 /**
  * Returns a composed {@link BiPredicate2} that first applies the {@code before} functions to its
  * input, and then applies this predicate to the result. If evaluation of either operation throws
  * an exception, it is relayed to the caller of the composed operation.
  *
  * @param <A> The type of the argument to the first given function, and of composed predicate
  * @param <B> The type of the argument to the second given function, and of composed predicate
  * @param before1 The first function to apply before this predicate is applied
  * @param before2 The second function to apply before this predicate is applied
  * @return A composed {@code BiPredicate2} that first applies the {@code before} functions to its
  *     input, and then applies this predicate to the result.
  * @throws NullPointerException If given argument is {@code null}
  * @implSpec The input argument of this method is able to handle every type.
  */
 @Nonnull
 default <A, B> BiPredicate2<A, B> compose(
     @Nonnull final Function<? super A, ? extends T> before1,
     @Nonnull final ToCharFunction<? super B> before2) {
   Objects.requireNonNull(before1);
   Objects.requireNonNull(before2);
   return (a, b) -> test(before1.apply(a), before2.applyAsChar(b));
 }
Пример #2
0
 /**
  * Creates a {@link ObjBiByteToCharFunction} which uses the {@code first} parameter of this one as
  * argument for the given {@link ToCharFunction}.
  *
  * @param <T> The type of the first argument to the function
  * @param function The function which accepts the {@code first} parameter of this one
  * @return Creates a {@code ObjBiByteToCharFunction} which uses the {@code first} parameter of
  *     this one as argument for the given {@code ToCharFunction}.
  * @throws NullPointerException If given argument is {@code null}
  */
 @Nonnull
 static <T> ObjBiByteToCharFunction<T> onlyFirst(
     @Nonnull final ToCharFunction<? super T> function) {
   Objects.requireNonNull(function);
   return (t, value1, value2) -> function.applyAsChar(t);
 }