Java Lambda - ToLongBiFunction example








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

Method

  1. ToLongBiFunction applyAsLong

Example

The following example shows how to use ToLongBiFunction.

import java.util.function.ToLongBiFunction;
//ww  w.  ja  va  2s.  c  om
public class Main {

  public static void main(String[] args) {
    ToLongBiFunction<String,String> i  = (x,y)-> Long.parseLong(x)+Long.parseLong(y);
    
    System.out.println(i.applyAsLong("2","2"));
  }
}

The code above generates the following result.