/** * Returns a composed {@link ThrowableToByteBiFunction} that first applies the {@code before} * predicates to its input, and then applies this function to the result. * * @param <A> The type of the argument to the first given predicate, and of composed function * @param <B> The type of the argument to the second given predicate, and of composed function * @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 ThrowableToByteBiFunction} 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 able to handle every type. */ @Nonnull default <A, B> ThrowableToByteBiFunction<A, B, X> compose( @Nonnull final ThrowablePredicate<? super A, ? extends X> before1, @Nonnull final ThrowablePredicate<? super B, ? extends X> before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (a, b) -> applyAsByteThrows(before1.testThrows(a), before2.testThrows(b)); }
/** * Returns a composed {@link ThrowableToByteTriFunction} that first applies the {@code before} * functions to its input, and then applies this function to the result. * * @param <A> The type of the argument to the first given function, and of composed function * @param <B> The type of the argument to the second given predicate, and of composed function * @param <C> The type of the argument to the third given predicate, and of composed function * @param before1 The first function to apply before this function is applied * @param before2 The second predicate to apply before this function is applied * @param before3 The third predicate to apply before this function is applied * @return A composed {@code ThrowableToByteTriFunction} that first applies the {@code before} * functions 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 able to handle every type. */ @Nonnull default <A, B, C> ThrowableToByteTriFunction<A, B, C, X> compose( @Nonnull final ThrowableFunction<? super A, ? extends T, ? extends X> before1, @Nonnull final ThrowablePredicate<? super B, ? extends X> before2, @Nonnull final ThrowablePredicate<? super C, ? extends X> before3) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); Objects.requireNonNull(before3); return (a, b, c) -> applyAsByteThrows(before1.applyThrows(a), before2.testThrows(b), before3.testThrows(c)); }