Java Lambda - ToLongBiFunction applyAsLong example








ToLongBiFunction applyAsLong applies this function to the given arguments.

Syntax

applyAsLong has the following syntax.

long applyAsLong(T t,  U u)

Example

The following example shows how to use applyAsLong.

import java.util.function.ToLongBiFunction;
/*from w w w. j  a  va 2 s  .  c o  m*/
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.