Example usage for java.util.function DoubleFunction apply

List of usage examples for java.util.function DoubleFunction apply

Introduction

In this page you can find the example usage for java.util.function DoubleFunction apply.

Prototype

R apply(double value);

Source Link

Document

Applies this function to the given argument.

Usage

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjDoubleConsumer.java

/**
 * Returns a composed {@link TriDoubleConsumer} 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 double} 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 operator to apply before this consumer is applied
 * @return A composed {@code TriDoubleConsumer} 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
 * double}.//from   w  ww  .ja v  a  2s  .c o m
 */
@Nonnull
default TriDoubleConsumer composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1,
        @Nonnull final DoubleFunction<? extends U> before2, @Nonnull final DoubleUnaryOperator before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsDouble(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjLongConsumer.java

/**
 * Returns a composed {@link TriDoubleConsumer} 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 double} 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 TriDoubleConsumer} 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
 * double}./* w w  w . j  av a 2  s  .com*/
 */
@Nonnull
default TriDoubleConsumer composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1,
        @Nonnull final DoubleFunction<? extends U> before2, @Nonnull final DoubleToLongFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsLong(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjFloatConsumer.java

/**
 * Returns a composed {@link TriDoubleConsumer} 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 double} 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 TriDoubleConsumer} 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
 * double}.//ww  w  . jav  a  2  s  .co  m
 */
@Nonnull
default TriDoubleConsumer composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1,
        @Nonnull final DoubleFunction<? extends U> before2, @Nonnull final DoubleToFloatFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsFloat(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjShortConsumer.java

/**
 * Returns a composed {@link TriDoubleConsumer} 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 double} 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 TriDoubleConsumer} 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
 * double}.//from   ww w  .java 2s.c  om
 */
@Nonnull
default TriDoubleConsumer composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1,
        @Nonnull final DoubleFunction<? extends U> before2, @Nonnull final DoubleToShortFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsShort(value3));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjByteToDoubleFunction.java

/**
 * Returns a composed {@link BiObjByteFunction} 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 BiObjByteFunction} 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  a2  s .c  o m*/
@Nonnull
default <S> BiObjByteFunction<T, U, S> andThen(@Nonnull final DoubleFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsDouble(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjCharToDoubleFunction.java

/**
 * Returns a composed {@link BiObjCharFunction} 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 BiObjCharFunction} 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  a v a2 s. c o m*/
@Nonnull
default <S> BiObjCharFunction<T, U, S> andThen(@Nonnull final DoubleFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsDouble(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjFloatToDoubleFunction.java

/**
 * Returns a composed {@link BiObjFloatFunction} 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 BiObjFloatFunction} 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   www.  j a  v a2 s.c  o m
@Nonnull
default <S> BiObjFloatFunction<T, U, S> andThen(@Nonnull final DoubleFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsDouble(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjShortToDoubleFunction.java

/**
 * Returns a composed {@link BiObjShortFunction} 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 BiObjShortFunction} 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 va 2s .co m*/
@Nonnull
default <S> BiObjShortFunction<T, U, S> andThen(@Nonnull final DoubleFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsDouble(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjDoubleToDoubleFunction.java

/**
 * Returns a composed {@link BiObjDoubleFunction} 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 BiObjDoubleFunction} 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  www .j  a va2 s  . c om*/
@Nonnull
default <S> BiObjDoubleFunction<T, U, S> andThen(@Nonnull final DoubleFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsDouble(t, u, value));
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjIntToDoubleFunction.java

/**
 * Returns a composed {@link BiObjIntFunction} 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 BiObjIntFunction} 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 ava  2s. c  om*/
@Nonnull
default <S> BiObjIntFunction<T, U, S> andThen(@Nonnull final DoubleFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, u, value) -> after.apply(applyAsDouble(t, u, value));
}