Java Lambda - ToIntBiFunction applyAsInt example








ToIntBiFunction applyAsInt applies this function to the given arguments.

Syntax

applyAsInt has the following syntax.

int applyAsInt(T t,  U u)

Example

The following example shows how to use applyAsInt.

import java.util.function.ToIntBiFunction;
/*w ww . j av  a 2  s . c  o  m*/
public class Main {

  public static void main(String[] args) {
    ToIntBiFunction<String,String> i  = (x,y)-> Integer.parseInt(x) +Integer.parseInt(x);
    
    System.out.println(i.applyAsInt("2","3"));
  }
}

The code above generates the following result.