Section 4.1: The Function Interface
Function is a functional interface with two type parameters T and R. Its functional method, called apply, takes an argument of type T and returns an object of type R. Functions are ideal for converting an object of type T to one of type R.
@FunctionalInterface
public interface Function<T, R>
{
R apply(T t);
...
}
A Function of String, Integer type is declared as follows:
Function<String, Integer> f;
Function f’s apply method will accept a String argument and return an Integer. The following statement represents this function using a lambda expression: ...