ToIntFunction is a functional interface that accepts one argument and returns an int type result. The interface contains one method, i.e., applyAsInt.
The ToIntFunction interface is defined in the java.util.function package. To import the ToIntFunction interface, check the following import statement.
import java.util.function.ToIntFunction;
applyAsInt(T value)This method applies the function to the given argument and returns the int type result. This is the functional method of the interface.
int applyAsInt(T value);
T value: This is the function argument.The method returns the result of type int.
import java.util.function.ToIntFunction;public class Main{public static void main(String[] args) {ToIntFunction<Integer> convertSumToInt = (i1) -> i1 + 5;Integer i1 = 5;// calling applyAsInt method of the ToIntFunctionSystem.out.println(convertSumToInt.applyAsInt(i1));}}