Java Lambda - IntBinaryOperator example








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

Method

  1. IntBinaryOperator applyAsInt

Example

The following example shows how to use IntBinaryOperator.

import java.util.function.IntBinaryOperator;
/*  ww w .  j  av  a  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.