Java Lambda - LongBinaryOperator example








LongBinaryOperator represents an operation upon two long-valued operands and producing a long-valued result. This is the primitive type specialization of BinaryOperator for long.

Method

  1. LongBinaryOperator applyAsLong

Example

The following example shows how to use LongBinaryOperator.

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.