Example usage for java.util.function DoubleUnaryOperator applyAsDouble

List of usage examples for java.util.function DoubleUnaryOperator applyAsDouble

Introduction

In this page you can find the example usage for java.util.function DoubleUnaryOperator applyAsDouble.

Prototype

double applyAsDouble(double operand);

Source Link

Document

Applies this operator to the given operand.

Usage

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

/**
 * Creates a {@link ObjBiDoubleToDoubleFunction} which uses the {@code third} parameter of this one as argument for
 * the given {@link DoubleUnaryOperator}.
 *
 * @param <T> The type of the first argument to the function
 * @param operator The operator which accepts the {@code third} parameter of this one
 * @return Creates a {@code ObjBiDoubleToDoubleFunction} which uses the {@code third} parameter of this one as
 * argument for the given {@code DoubleUnaryOperator}.
 * @throws NullPointerException If given argument is {@code null}
 *///from  www .  jav a 2 s.com
@Nonnull
static <T> ObjBiDoubleToDoubleFunction<T> onlyThird(@Nonnull final DoubleUnaryOperator operator) {
    Objects.requireNonNull(operator);
    return (t, value1, value2) -> operator.applyAsDouble(value2);
}

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

/**
 * Creates a {@link BiObjDoubleToDoubleFunction} which uses the {@code third} parameter of this one as argument for
 * the given {@link DoubleUnaryOperator}.
 *
 * @param <T> The type of the first argument to the function
 * @param <U> The type of the second argument to the function
 * @param operator The operator which accepts the {@code third} parameter of this one
 * @return Creates a {@code BiObjDoubleToDoubleFunction} which uses the {@code third} parameter of this one as
 * argument for the given {@code DoubleUnaryOperator}.
 * @throws NullPointerException If given argument is {@code null}
 *///from  w ww  . j a  v  a 2 s  .co  m
@Nonnull
static <T, U> BiObjDoubleToDoubleFunction<T, U> onlyThird(@Nonnull final DoubleUnaryOperator operator) {
    Objects.requireNonNull(operator);
    return (t, u, value) -> operator.applyAsDouble(value);
}

From source file:at.gridtec.lambda4j.function.bi.to.ToDoubleBiFunction2.java

/**
 * Returns a composed {@link ToDoubleBiFunction2} that first applies this function to its input, and then applies
 * the {@code after} operator 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 transform this
 * primitive function to an operation returning {@code double}.
 *
 * @param after The operator to apply after this function is applied
 * @return A composed {@code ToDoubleBiFunction2} that first applies this function to its input, and then applies
 * the {@code after} operator to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.//from w  w  w. j a va  2 s . c  o  m
 */
@Nonnull
default ToDoubleBiFunction2<T, U> andThenToDouble(@Nonnull final DoubleUnaryOperator after) {
    Objects.requireNonNull(after);
    return (t, u) -> after.applyAsDouble(applyAsDouble(t, u));
}

From source file:at.gridtec.lambda4j.function.tri.to.ToDoubleTriFunction.java

/**
 * Returns a composed {@link ToDoubleTriFunction} that first applies this function to its input, and then applies
 * the {@code after} operator 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 transform this
 * primitive function to an operation returning {@code double}.
 *
 * @param after The operator to apply after this function is applied
 * @return A composed {@code ToDoubleTriFunction} that first applies this function to its input, and then applies
 * the {@code after} operator to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.//  w ww . j ava2s.  c  o m
 */
@Nonnull
default ToDoubleTriFunction<T, U, V> andThenToDouble(@Nonnull final DoubleUnaryOperator after) {
    Objects.requireNonNull(after);
    return (t, u, v) -> after.applyAsDouble(applyAsDouble(t, u, v));
}

From source file:at.gridtec.lambda4j.function.bi.BiDoubleFunction.java

/**
 * Returns a composed {@link BiDoubleFunction} that first applies the {@code before} operators 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 operator 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} operators 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  .  j  av  a2  s.  c o m*/
 */
@Nonnull
default BiDoubleFunction<R> composeFromDouble(@Nonnull final DoubleUnaryOperator before1,
        @Nonnull final DoubleUnaryOperator before2) {
    Objects.requireNonNull(before1);
    Objects.requireNonNull(before2);
    return (value1, value2) -> apply(before1.applyAsDouble(value1), before2.applyAsDouble(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 w  w w .  ja  v a2 s .  co  m*/
 */
@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.conversion.BiBooleanToDoubleFunction.java

/**
 * Returns a composed {@link BiBooleanToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} operator 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
 * transform this primitive function to an operation returning {@code double}.
 *
 * @param after The operator to apply after this function is applied
 * @return A composed {@code BiBooleanToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} operator to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.//  ww w. j a va 2s . c o  m
 */
@Nonnull
default BiBooleanToDoubleFunction andThenToDouble(@Nonnull final DoubleUnaryOperator after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.applyAsDouble(applyAsDouble(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiByteToDoubleFunction.java

/**
 * Returns a composed {@link BiByteToDoubleFunction} that first applies this function to its input, and then applies
 * the {@code after} operator 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 transform this
 * primitive function to an operation returning {@code double}.
 *
 * @param after The operator to apply after this function is applied
 * @return A composed {@code BiByteToDoubleFunction} that first applies this function to its input, and then applies
 * the {@code after} operator to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}./*  www . j a  v  a2 s  .  co m*/
 */
@Nonnull
default BiByteToDoubleFunction andThenToDouble(@Nonnull final DoubleUnaryOperator after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.applyAsDouble(applyAsDouble(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiCharToDoubleFunction.java

/**
 * Returns a composed {@link BiCharToDoubleFunction} that first applies this function to its input, and then applies
 * the {@code after} operator 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 transform this
 * primitive function to an operation returning {@code double}.
 *
 * @param after The operator to apply after this function is applied
 * @return A composed {@code BiCharToDoubleFunction} that first applies this function to its input, and then applies
 * the {@code after} operator to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}.//from   w w w. j a v a2s . com
 */
@Nonnull
default BiCharToDoubleFunction andThenToDouble(@Nonnull final DoubleUnaryOperator after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.applyAsDouble(applyAsDouble(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiFloatToDoubleFunction.java

/**
 * Returns a composed {@link BiFloatToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} operator 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
 * transform this primitive function to an operation returning {@code double}.
 *
 * @param after The operator to apply after this function is applied
 * @return A composed {@code BiFloatToDoubleFunction} that first applies this function to its input, and then
 * applies the {@code after} operator to the result.
 * @throws NullPointerException If given argument is {@code null}
 * @implSpec The input argument of this method is a able to return primitive values. In this case this is {@code
 * double}./*from   ww w.j  av a2 s.c o  m*/
 */
@Nonnull
default BiFloatToDoubleFunction andThenToDouble(@Nonnull final DoubleUnaryOperator after) {
    Objects.requireNonNull(after);
    return (value1, value2) -> after.applyAsDouble(applyAsDouble(value1, value2));
}