June 2018
Beginner
722 pages
18h 47m
English
The notation of this and other functional <indexentry content="standard functional interfaces:function"> interfaces includes listing of the types of the input data (T) and the returned data (R). So, Function<T, R> means that the only abstract method of this interface accepts an argument of type T and produces a result of type R. You can find the name of that abstract method by reading the online documentation. In the case of the Function<T, R> interface, its method is R apply(T).
After learning all that, we can create an implementation of this interface using an anonymous class:
Function<Integer, Double> multiplyByTen = new Function<Integer, Double>(){ public Double apply(Integer i){ return i * 10.0; }};
It is up to the programmer ...
Read now
Unlock full access