List of usage examples for java.util.function ToDoubleFunction applyAsDouble
double applyAsDouble(T value);
From source file:at.gridtec.lambda4j.function.bi.BiDoubleFunction.java
/** * Returns a composed {@link BiFunction2} 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. * * @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 BiFunction2} that first applies the {@code before} functions to its input, and then * applies this function to the result.//from www .j av a 2 s. co m * @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> BiFunction2<A, B, R> compose(@Nonnull final ToDoubleFunction<? super A> before1, @Nonnull final ToDoubleFunction<? super B> before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (a, b) -> apply(before1.applyAsDouble(a), before2.applyAsDouble(b)); }
From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjDoubleConsumer.java
/** * Returns a composed {@link TriConsumer} 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. * * @param <A> The type of the argument to the first given function, and of composed consumer * @param <B> The type of the argument to the second given function, and of composed consumer * @param <C> The type of the argument to the third given function, and of composed consumer * @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 TriConsumer} that first applies the {@code before} functions to its input, and then * applies this consumer to the result.// w ww .ja v a 2s . c o m * @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> TriConsumer<A, B, C> compose(@Nonnull final Function<? super A, ? extends T> before1, @Nonnull final Function<? super B, ? extends U> before2, @Nonnull final ToDoubleFunction<? super C> before3) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); Objects.requireNonNull(before3); return (a, b, c) -> accept(before1.apply(a), before2.apply(b), before3.applyAsDouble(c)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleToByteFunction.java
/** * Returns a composed {@link ToByteBiFunction} 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. * * @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 ToByteBiFunction} 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. *//*from w ww .ja va2 s . co m*/ @Nonnull default <A, B> ToByteBiFunction<A, B> compose(@Nonnull final Function<? super A, ? extends T> before1, @Nonnull final ToDoubleFunction<? super B> before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (a, b) -> applyAsByte(before1.apply(a), before2.applyAsDouble(b)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleToCharFunction.java
/** * Returns a composed {@link ToCharBiFunction} 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. * * @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 ToCharBiFunction} 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. *///from ww w. java 2s . c o m @Nonnull default <A, B> ToCharBiFunction<A, B> compose(@Nonnull final Function<? super A, ? extends T> before1, @Nonnull final ToDoubleFunction<? super B> before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (a, b) -> applyAsChar(before1.apply(a), before2.applyAsDouble(b)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleToFloatFunction.java
/** * Returns a composed {@link ToFloatBiFunction} 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. * * @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 ToFloatBiFunction} 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. *//*from w w w . java2 s . co m*/ @Nonnull default <A, B> ToFloatBiFunction<A, B> compose(@Nonnull final Function<? super A, ? extends T> before1, @Nonnull final ToDoubleFunction<? super B> before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (a, b) -> applyAsFloat(before1.apply(a), before2.applyAsDouble(b)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleToIntFunction.java
/** * Returns a composed {@link ToIntBiFunction2} 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. * * @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 ToIntBiFunction2} 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. *//* ww w .j a v a 2 s . com*/ @Nonnull default <A, B> ToIntBiFunction2<A, B> compose(@Nonnull final Function<? super A, ? extends T> before1, @Nonnull final ToDoubleFunction<? super B> before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (a, b) -> applyAsInt(before1.apply(a), before2.applyAsDouble(b)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleToShortFunction.java
/** * Returns a composed {@link ToShortBiFunction} 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. * * @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 ToShortBiFunction} 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. *//*from ww w . j a v a 2 s. c om*/ @Nonnull default <A, B> ToShortBiFunction<A, B> compose(@Nonnull final Function<? super A, ? extends T> before1, @Nonnull final ToDoubleFunction<? super B> before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (a, b) -> applyAsShort(before1.apply(a), before2.applyAsDouble(b)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleToDoubleFunction.java
/** * Returns a composed {@link ToDoubleBiFunction2} 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. * * @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 ToDoubleBiFunction2} 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. *//*from w ww . j a v a 2 s . c o m*/ @Nonnull default <A, B> ToDoubleBiFunction2<A, B> compose(@Nonnull final Function<? super A, ? extends T> before1, @Nonnull final ToDoubleFunction<? super B> before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (a, b) -> applyAsDouble(before1.apply(a), before2.applyAsDouble(b)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleToLongFunction.java
/** * Returns a composed {@link ToLongBiFunction2} 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. * * @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 ToLongBiFunction2} 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. *///from w ww . java 2 s . com @Nonnull default <A, B> ToLongBiFunction2<A, B> compose(@Nonnull final Function<? super A, ? extends T> before1, @Nonnull final ToDoubleFunction<? super B> before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (a, b) -> applyAsLong(before1.apply(a), before2.applyAsDouble(b)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiDoubleToByteFunction.java
/** * Returns a composed {@link ToByteBiFunction} 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. * * @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 ToByteBiFunction} 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. */// ww w . j a v a 2s . c o m @Nonnull default <A, B> ToByteBiFunction<A, B> compose(@Nonnull final ToDoubleFunction<? super A> before1, @Nonnull final ToDoubleFunction<? super B> before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (a, b) -> applyAsByte(before1.applyAsDouble(a), before2.applyAsDouble(b)); }