Java Lambda - LongFunction example

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


  1. LongFunction apply


The following example shows how to use LongFunction.

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

  public static void main(String[] args) {
    LongFunction<String> i = (l) -> Long.toString(l);

The code above generates the following result.