List of usage examples for java.util.function DoubleFunction apply
R apply(double value);
From source file:at.gridtec.lambda4j.function.bi.obj.ObjShortFunction.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 www . j a v a 2 s . co m*/ */ @Nonnull default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1, @Nonnull final DoubleToShortFunction before2) { Objects.requireNonNull(before1); Objects.requireNonNull(before2); return (value1, value2) -> apply(before1.apply(value1), before2.applyAsShort(value2)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleToDoubleFunction.java
/** * Returns a composed {@link ObjDoubleFunction} 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 ObjDoubleFunction} 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 ww . j av a 2s . c o m*/ @Nonnull default <S> ObjDoubleFunction<T, S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (t, value) -> after.apply(applyAsDouble(t, value)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjBooleanToDoubleFunction.java
/** * Returns a composed {@link ObjBooleanFunction} 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 ObjBooleanFunction} 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 ww . ja va2s. c om @Nonnull default <S> ObjBooleanFunction<T, S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (t, value) -> after.apply(applyAsDouble(t, value)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjByteToDoubleFunction.java
/** * Returns a composed {@link ObjByteFunction} 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 ObjByteFunction} 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 ww .j a v a2s . c o m*/ @Nonnull default <S> ObjByteFunction<T, S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (t, value) -> after.apply(applyAsDouble(t, value)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjCharToDoubleFunction.java
/** * Returns a composed {@link ObjCharFunction} 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 ObjCharFunction} 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> ObjCharFunction<T, S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (t, value) -> after.apply(applyAsDouble(t, value)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjFloatToDoubleFunction.java
/** * Returns a composed {@link ObjFloatFunction} 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 ObjFloatFunction} 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. *///ww w .j a v a 2s . c o m @Nonnull default <S> ObjFloatFunction<T, S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (t, value) -> after.apply(applyAsDouble(t, value)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjShortToDoubleFunction.java
/** * Returns a composed {@link ObjShortFunction} 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 ObjShortFunction} 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 2 s .c o m @Nonnull default <S> ObjShortFunction<T, S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (t, value) -> after.apply(applyAsDouble(t, value)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjIntToDoubleFunction.java
/** * Returns a composed {@link ObjIntFunction} 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 ObjIntFunction} 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> ObjIntFunction<T, S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (t, value) -> after.apply(applyAsDouble(t, value)); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjLongToDoubleFunction.java
/** * Returns a composed {@link ObjLongFunction} 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 ObjLongFunction} 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 2 s.com*/ @Nonnull default <S> ObjLongFunction<T, S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (t, value) -> after.apply(applyAsDouble(t, value)); }
From source file:at.gridtec.lambda4j.operator.binary.DoubleBinaryOperator2.java
/** * Returns a composed {@link BiDoubleFunction} that first applies this operator 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 operator is applied * @return A composed {@code BiDoubleFunction} that first applies this operator 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. *//*ww w . jav a 2 s . c o m*/ @Nonnull default <S> BiDoubleFunction<S> andThen(@Nonnull final DoubleFunction<? extends S> after) { Objects.requireNonNull(after); return (value1, value2) -> after.apply(applyAsDouble(value1, value2)); }