Functions are exactly same as predicates except that functions can return any type of result but function should (can) return only one value and that value can be any type as per our requirement. To implement functions oracle people introduced Function interface in 1 .8version. Function Interface present in java.util.function package. Functional interface contains only one method i.e., apply()
Write a function to find the length of given input string.
Predicate is a Boolean valued function and(), or(), negate() are default methods present inside Predicate interface.