Java Lambda - ToIntBiFunction example








ToIntBiFunction represents a function that accepts two arguments and produces an int-valued result. This is the int-producing primitive specialization for BiFunction.

Method

  1. ToIntBiFunction applyAsInt

Example

The following example shows how to use ToIntBiFunction.

import java.util.function.ToIntBiFunction;
/*w ww.j  a va  2 s.  co 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.