Java Lambda - IntBinaryOperator applyAsInt example








IntBinaryOperator applyAsInt applies this operator to the given operands.

Syntax

applyAsInt has the following syntax.

int applyAsInt(int left,  int right)

Example

The following example shows how to use applyAsInt.

import java.util.function.IntBinaryOperator;
/*from  w  ww .  java 2s.  c o m*/
public class Main {

  public static void main(String[] args) {
    IntBinaryOperator io = (x,y)->x +y;
    
    System.out.println(io.applyAsInt(2,3));

  }
}

The code above generates the following result.