/** * Returns a composed {@link ThrowableToIntBiFunction} 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 function, and of composed function * @param before1 The first function to apply before this function is applied * @param before2 The second function to apply before this function is applied * @return A composed {@code ThrowableToIntBiFunction} 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> ThrowableToIntBiFunction<A, B, X> compose( @Nonnull final ThrowableToByteFunction<? super A, ? extends X> before1, @Nonnull final ThrowableToByteFunction<? super B, ? extends X> before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (a, b) -> applyAsIntThrows(before1.applyAsByteThrows(a), before2.applyAsByteThrows(b)); }
/** * Returns a composed {@link ThrowableToFloatTriFunction} 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 function, and of composed function * @param <C> The type of the argument to the third given function, and of composed function * @param before1 The first function to apply before this function is applied * @param before2 The second function to apply before this function is applied * @param before3 The third function to apply before this function is applied * @return A composed {@code ThrowableToFloatTriFunction} 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> ThrowableToFloatTriFunction<A, B, C, X> compose( @Nonnull final ThrowableToByteFunction<? super A, ? extends X> before1, @Nonnull final ThrowableToByteFunction<? super B, ? extends X> before2, @Nonnull final ThrowableToByteFunction<? super C, ? extends X> before3) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); Objects.requireNonNull(before3); return (a, b, c) -> applyAsFloatThrows( before1.applyAsByteThrows(a), before2.applyAsByteThrows(b), before3.applyAsByteThrows(c)); }
/** * Creates a {@link ThrowableObjBiBooleanToByteFunction} which uses the {@code first} parameter of * this one as argument for the given {@link ThrowableToByteFunction}. * * @param <T> The type of the first argument to the function * @param <X> The type of the throwable to be thrown by this function * @param function The function which accepts the {@code first} parameter of this one * @return Creates a {@code ThrowableObjBiBooleanToByteFunction} which uses the {@code first} * parameter of this one as argument for the given {@code ThrowableToByteFunction}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T, X extends Throwable> ThrowableObjBiBooleanToByteFunction<T, X> onlyFirst( @Nonnull final ThrowableToByteFunction<? super T, ? extends X> function) { Objects.requireNonNull(function); return (t, value1, value2) -> function.applyAsByteThrows(t); }