コード例 #1
0
 /**
  * Returns a composed {@link BiCharToFloatFunction} that first applies the {@code before}
  * functions to its input, and then applies this function to the result. If evaluation of either
  * operation throws an exception, it is relayed to the caller of the composed operation. This
  * method is just convenience, to provide the ability to execute an operation which accepts {@code
  * char} input, before this primitive function is executed.
  *
  * @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 BiCharToFloatFunction} 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 a able to handle primitive values. In this case
  *     this is {@code char}.
  */
 @Nonnull
 default BiCharToFloatFunction composeFromChar(
     @Nonnull final CharFunction<? extends T> before1, @Nonnull final CharToByteFunction before2) {
   Objects.requireNonNull(before1);
   Objects.requireNonNull(before2);
   return (value1, value2) -> applyAsFloat(before1.apply(value1), before2.applyAsByte(value2));
 }
コード例 #2
0
 /**
  * Returns a composed {@link BiCharPredicate} 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. This method is just
  * convenience, to provide the ability to execute an operation which accepts {@code char} input,
  * before this primitive predicate is executed.
  *
  * @param before1 The first function to apply before this predicate is applied
  * @param before2 The second operator to apply before this predicate is applied
  * @return A composed {@code BiCharPredicate} 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 a able to handle primitive values. In this case
  *     this is {@code char}.
  */
 @Nonnull
 default BiCharPredicate composeFromChar(
     @Nonnull final CharFunction<? extends T> before1, @Nonnull final CharUnaryOperator before2) {
   Objects.requireNonNull(before1);
   Objects.requireNonNull(before2);
   return (value1, value2) -> test(before1.apply(value1), before2.applyAsChar(value2));
 }
コード例 #3
0
 /**
  * Returns a composed {@link TriCharConsumer} that first applies the {@code before} functions to
  * its input, and then applies this consumer to the result. If evaluation of either operation
  * throws an exception, it is relayed to the caller of the composed operation. This method is just
  * convenience, to provide the ability to execute an operation which accepts {@code char} input,
  * before this primitive consumer is executed.
  *
  * @param before1 The first function to apply before this consumer is applied
  * @param before2 The second function to apply before this consumer is applied
  * @param before3 The third function to apply before this consumer is applied
  * @return A composed {@code TriCharConsumer} that first applies the {@code before} functions to
  *     its input, and then applies this consumer 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 TriCharConsumer composeFromChar(
     @Nonnull final CharFunction<? extends T> before1,
     @Nonnull final CharToIntFunction before2,
     @Nonnull final CharToIntFunction before3) {
   Objects.requireNonNull(before1);
   Objects.requireNonNull(before2);
   Objects.requireNonNull(before3);
   return (value1, value2, value3) ->
       accept(before1.apply(value1), before2.applyAsInt(value2), before3.applyAsInt(value3));
 }
コード例 #4
0
 /**
  * Returns a composed {@link CharTernaryOperator} that first applies the {@code before} functions
  * to its input, and then applies this function to the result. If evaluation of either operation
  * throws an exception, it is relayed to the caller of the composed operation. This method is just
  * convenience, to provide the ability to execute an operation which accepts {@code char} input,
  * before this primitive function is executed.
  *
  * @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 CharTernaryOperator} 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 a able to handle primitive values. In this case
  *     this is {@code char}.
  */
 @Nonnull
 default CharTernaryOperator composeFromChar(
     @Nonnull final CharFunction<? extends T> before1,
     @Nonnull final CharToByteFunction before2,
     @Nonnull final CharToByteFunction before3) {
   Objects.requireNonNull(before1);
   Objects.requireNonNull(before2);
   Objects.requireNonNull(before3);
   return (value1, value2, value3) ->
       applyAsChar(
           before1.apply(value1), before2.applyAsByte(value2), before3.applyAsByte(value3));
 }
コード例 #5
0
 /**
  * Returns a composed {@link ObjBiByteFunction} that first applies this function to its input, and
  * then applies the {@code after} function to the result. If evaluation of either operation throws
  * an exception, it is relayed to the caller of the composed operation.
  *
  * @param <S> The type of return value from the {@code after} function, and of the composed
  *     function
  * @param after The function to apply after this function is applied
  * @return A composed {@code ObjBiByteFunction} that first applies this function to its input, and
  *     then applies the {@code after} function to the result.
  * @throws NullPointerException If given argument is {@code null}
  * @implSpec The input argument of this method is able to return every type.
  */
 @Nonnull
 default <S> ObjBiByteFunction<T, S> andThen(@Nonnull final CharFunction<? extends S> after) {
   Objects.requireNonNull(after);
   return (t, value1, value2) -> after.apply(applyAsChar(t, value1, value2));
 }
コード例 #6
0
ファイル: CharSupplier.java プロジェクト: gridtec/lambda4j
 /**
  * Returns a composed {@link Supplier2} that first applies this supplier to its input, and then
  * applies the {@code after} function to the result. If evaluation of either operation throws an
  * exception, it is relayed to the caller of the composed operation.
  *
  * @param <S> The type of return value from the {@code after} function, and of the composed
  *     supplier
  * @param after The function to apply after this supplier is applied
  * @return A composed {@code Supplier2} that first applies this supplier to its input, and then
  *     applies the {@code after} function to the result.
  * @throws NullPointerException If given argument is {@code null}
  * @implSpec The input argument of this method is able to return every type.
  */
 @Nonnull
 default <S> Supplier2<S> andThen(@Nonnull final CharFunction<? extends S> after) {
   Objects.requireNonNull(after);
   return () -> after.apply(getAsChar());
 }