/** * Returns a composed {@link ThrowableCharToShortFunction} that first applies the {@code before} * function to its input, and then applies this operator to the result. This method is just * convenience, to provide the ability to execute an operation which accepts {@code char} input, * before this primitive operator is executed. * * @param before The function to apply before this operator is applied * @return A composed {@code ThrowableCharToShortFunction} that first applies the {@code before} * function to its input, and then applies this operator 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 ThrowableCharToShortFunction<X> composeFromChar( @Nonnull final ThrowableCharToShortFunction<? extends X> before) { Objects.requireNonNull(before); return (value) -> applyAsShortThrows(before.applyAsShortThrows(value)); }
/** * Creates a {@link ThrowableBiCharToShortFunction} which uses the {@code second} parameter of * this one as argument for the given {@link ThrowableCharToShortFunction}. * * @param <X> The type of the throwable to be thrown by this function * @param function The function which accepts the {@code second} parameter of this one * @return Creates a {@code ThrowableBiCharToShortFunction} which uses the {@code second} * parameter of this one as argument for the given {@code ThrowableCharToShortFunction}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <X extends Throwable> ThrowableBiCharToShortFunction<X> onlySecond( @Nonnull final ThrowableCharToShortFunction<? extends X> function) { Objects.requireNonNull(function); return (value1, value2) -> function.applyAsShortThrows(value2); }