IntFunction apply example

Description

IntFunction apply applies this function to the given argument.

Syntax

apply has the following syntax.


R apply(int value)

Example

The following example shows how to use apply.


import java.util.function.IntFunction;
//from   ww w .jav a2s . co m
public class Main {

  public static void main(String[] args) {
    IntFunction<String> i = (x)->Integer.toString(x);
    
    System.out.println(i.apply(3).length());

  }
}

The code above generates the following result.