© Ralph Lecessi 2019Ralph LecessiFunctional Interfaces in Javahttps://doi.org/10.1007/978-1-4842-4278-0_4
Kendall Park, NJ, USA
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.
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: ...