Java Lambda - IntFunction apply example

IntFunction apply applies this function to the given argument.


apply has the following syntax.

R apply(int value)


The following example shows how to use apply.

import java.util.function.IntFunction;
/*  ww  w . j av  a 2 s  .  c o m*/
public class Main {

  public static void main(String[] args) {
    IntFunction<String> i = (x)->Integer.toString(x);


The code above generates the following result.