List of usage examples for java.util.function DoubleFunction apply
R apply(double value);
From source file:at.gridtec.lambda4j.function.bi.conversion.BiShortToDoubleFunction.java
/** * Returns a composed {@link BiShortFunction} 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 BiShortFunction} 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. *///from w w w. ja v a 2 s. c o m @Nonnull default <S> BiShortFunction<S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (value1, value2) -> after.apply(applyAsDouble(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiIntToDoubleFunction.java
/** * Returns a composed {@link BiIntFunction} 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 BiIntFunction} 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. *//* w w w . j a v a 2s . com*/ @Nonnull default <S> BiIntFunction<S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (value1, value2) -> after.apply(applyAsDouble(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.conversion.BiLongToDoubleFunction.java
/** * Returns a composed {@link BiLongFunction} 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 BiLongFunction} 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. *//*from w w w .j ava 2s.c om*/ @Nonnull default <S> BiLongFunction<S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (value1, value2) -> after.apply(applyAsDouble(value1, value2)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjBooleanFunction.java
/** * Returns a composed {@link BiDoubleFunction} 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 double} input, before this primitive function is executed. * * @param before1 The first function to apply before this function is applied * @param before2 The second predicate to apply before this function is applied * @return A composed {@code BiDoubleFunction} 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 * double}./*from w w w . ja v a2 s. co m*/ */ @Nonnull default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1, @Nonnull final DoublePredicate before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> apply(before1.apply(value1), before2.test(value2)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjByteFunction.java
/** * Returns a composed {@link BiDoubleFunction} 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 double} 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 BiDoubleFunction} 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 * double}./*w ww . ja v a 2 s . c o m*/ */ @Nonnull default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1, @Nonnull final DoubleToByteFunction before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> apply(before1.apply(value1), before2.applyAsByte(value2)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjCharFunction.java
/** * Returns a composed {@link BiDoubleFunction} 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 double} 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 BiDoubleFunction} 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 * double}.//w w w . j av a2 s. c o m */ @Nonnull default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1, @Nonnull final DoubleToCharFunction before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> apply(before1.apply(value1), before2.applyAsChar(value2)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjIntFunction.java
/** * Returns a composed {@link BiDoubleFunction} 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 double} 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 BiDoubleFunction} 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 * double}./* w w w . j a va 2 s . c o m*/ */ @Nonnull default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1, @Nonnull final DoubleToIntFunction before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> apply(before1.apply(value1), before2.applyAsInt(value2)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleFunction.java
/** * Returns a composed {@link BiDoubleFunction} 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 double} input, before this primitive function is executed. * * @param before1 The first function to apply before this function is applied * @param before2 The second operator to apply before this function is applied * @return A composed {@code BiDoubleFunction} 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 * double}./*from ww w .j ava2 s. c om*/ */ @Nonnull default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1, @Nonnull final DoubleUnaryOperator before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> apply(before1.apply(value1), before2.applyAsDouble(value2)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjLongFunction.java
/** * Returns a composed {@link BiDoubleFunction} 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 double} 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 BiDoubleFunction} 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 * double}.//from ww w . j ava2s.c o m */ @Nonnull default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1, @Nonnull final DoubleToLongFunction before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> apply(before1.apply(value1), before2.applyAsLong(value2)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjFloatFunction.java
/** * Returns a composed {@link BiDoubleFunction} 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 double} 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 BiDoubleFunction} 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 * double}.//from w ww .ja v a2 s . co m */ @Nonnull default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1, @Nonnull final DoubleToFloatFunction before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> apply(before1.apply(value1), before2.applyAsFloat(value2)); }