Java Functional Programming : 6. Function
This is the multi part series on Java Functional Programming 6. Function Apart from the apply method (which is abstract ) the Function functional interface also has a static method and two default methods. We have seen the usage of apply method. It converts (or applies) one type to another. Let us investigate the default and static methods of this functional interface . Category Function Interface Definition Function<T, R> Abstract Method R apply (T t) Static Method <T> Function<T,T> identity() Default Method 1 <V> Function<T,V> andThen(Function<? super R,? extends V> after) Default Method 2 <V> Function<V,R> compose(Function<? super V,? extends T> before) Let us see how these methods look from the inside. The static function identity gives back the lambda function which always returns ...