Java Lambda - DoubleBinaryOperator example








DoubleBinaryOperator represents an operation on two double-valued operands and producing a double-valued result.

Method

  1. DoubleBinaryOperator applyAsDouble

Example

The following example shows how to use DoubleBinaryOperator.

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.