Java Lambda - LongBinaryOperator applyAsLong example








LongBinaryOperator applyAsLong applies this operator to the given operands.

Syntax

applyAsLong has the following syntax.

long applyAsLong(long left,  long right)

Example

The following example shows how to use applyAsLong.

import java.util.function.LongBinaryOperator;

public class Main {

  public static void main(String[] args) {
    LongBinaryOperator i = (x,y) -> x/y;
    System.out.println(i.applyAsLong(Long.MAX_VALUE,Long.MAX_VALUE));
  }
}

The code above generates the following result.