Java Lambda - LongFunction apply example








LongFunction apply applies this function to the given argument.

Syntax

apply has the following syntax.

R apply(long value)

Example

The following example shows how to use apply.

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