Function and BiFunction Functional Interface - JAVA 8
Function and BiFunction Functional Interface In my previous blog, I’ve already talked about Predicate and BiPredicate Functional Interface. In this blog, I’ll talk about next predefined Functional Interface i.e. Function and BiFunction Functional Interface. Function is a Functional Interface which accept single input and returns another. The functional method of Predicate is R apply(T t). @FunctionalInterface Public interface Function<T, R> { …} Here is a simple source code of java.util.function.Function package java.util.function; import java.util.Objects; @FunctionalInterface public interface Function<T, R> { public <R> apply(T t); } Where R apply (T t) is an abstract method where T is the type of the input to the Function and will return type of R. Example 1: import java.util.function.Function; public class FunctionExample { ...