Java Lambda - DoubleBinaryOperator applyAsDouble example








DoubleBinaryOperator applyAsDouble method applies this operator to the given operands.

Syntax

applyAsDouble has the following syntax.

double applyAsDouble(double left,  double right)

Example

The following example shows how to use applyAsDouble.

import java.util.function.DoubleBinaryOperator;

public class Main {
  public static void main(String[] args) {
    DoubleBinaryOperator d = (x,y) -> x*y;
    System.out.println(d.applyAsDouble(0.23, 0.45));
  }
}

The code above generates the following result.