LongFunction example

Description

LongFunction represents a function that accepts a long-valued argument and produces a result. This is the long-consuming primitive specialization for Function.

Example

The following example shows how to use LongFunction.


import java.util.function.LongFunction;
//  w w  w. j  ava 2 s  .  c  om
public class Main {

  public static void main(String[] args) {
    LongFunction<String> i = (l) -> Long.toString(l);
    
    System.out.println(i.apply(Long.MAX_VALUE));
  }
}

The code above generates the following result.