/** * Returns a composed {@link ThrowableShortUnaryOperator} that first applies this operator to its * input, and then applies the {@code after} operator to the result. This method is just * convenience, to provide the ability to transform this primitive operator to an operation * returning {@code short}. * * @param after The operator to apply after this operator is applied * @return A composed {@code ThrowableShortUnaryOperator} that first applies this operator to its * input, and then applies the {@code after} operator 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 short}. */ @Nonnull default ThrowableShortUnaryOperator<X> andThenToShort( @Nonnull final ThrowableShortUnaryOperator<? extends X> after) { Objects.requireNonNull(after); return (value) -> after.applyAsShortThrows(applyAsShortThrows(value)); }
/** * Calls the given {@link ThrowableShortUnaryOperator} with the given argument and returns its * result. * * @param <X> The type of the throwable to be thrown by this operator * @param operator The operator to be called * @param value The argument to the operator * @return The result from the given {@code ThrowableShortUnaryOperator}. * @throws NullPointerException If given argument is {@code null} * @throws X Any throwable from this operators action */ static <X extends Throwable> short call( @Nonnull final ThrowableShortUnaryOperator<? extends X> operator, short value) throws X { Objects.requireNonNull(operator); return operator.applyAsShortThrows(value); }
/** * Returns a composed {@link ThrowableShortUnaryOperator} that first applies the {@code before} * operator 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 short} input, * before this primitive operator is executed. * * @param before The operator to apply before this operator is applied * @return A composed {@code ThrowableShortUnaryOperator} that first applies the {@code before} * operator 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 short}. */ @Nonnull default ThrowableShortUnaryOperator<X> composeFromShort( @Nonnull final ThrowableShortUnaryOperator<? extends X> before) { Objects.requireNonNull(before); return (value) -> applyAsShortThrows(before.applyAsShortThrows(value)); }