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.function.tri.obj.ObjBiCharToDoubleFunction.java

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

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

/**
 * Returns a composed {@link ObjBiDoubleFunction} 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 ObjBiDoubleFunction} 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  ww.  j  a v a  2s.c om*/
@Nonnull
default <S> ObjBiDoubleFunction<T, S> andThen(@Nonnull final DoubleFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.apply(applyAsDouble(t, value1, value2));
}

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

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

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

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

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

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

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

/**
 * Returns a composed {@link ObjBiLongFunction} 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 ObjBiLongFunction} 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.
 *//*  www. java  2 s .  c  o  m*/
@Nonnull
default <S> ObjBiLongFunction<T, S> andThen(@Nonnull final DoubleFunction<? extends S> after) {
    Objects.requireNonNull(after);
    return (t, value1, value2) -> after.apply(applyAsDouble(t, value1, value2));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjBooleanConsumer.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 predicate 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 w  w  . j a va  2  s  .c o  m*/
 */
@Nonnull
default TriDoubleConsumer composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1,
        @Nonnull final DoubleFunction<? extends U> before2, @Nonnull final DoublePredicate before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.test(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjByteConsumer.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   www.j  a  v a  2s .  c om
 */
@Nonnull
default TriDoubleConsumer composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1,
        @Nonnull final DoubleFunction<? extends U> before2, @Nonnull final DoubleToByteFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsByte(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjCharConsumer.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 .  j a va  2s. c  om*/
 */
@Nonnull
default TriDoubleConsumer composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1,
        @Nonnull final DoubleFunction<? extends U> before2, @Nonnull final DoubleToCharFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsChar(value3));
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjIntConsumer.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   www .  j a  va2 s .  c o m*/
 */
@Nonnull
default TriDoubleConsumer composeFromDouble(@Nonnull final DoubleFunction<? extends T> before1,
        @Nonnull final DoubleFunction<? extends U> before2, @Nonnull final DoubleToIntFunction before3) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    Objects.requireNonNull(before3);
    return (value1, value2, value3) -> accept(before1.apply(value1), before2.apply(value2),
            before3.applyAsInt(value3));
}