Function Method Java Example

Function Method Java Example

java.util.function in Java 8 introduced many useful interfaces which can be use effectively for lambda expressions and method references. Here we will see how to use Function interface

Interface Function<T,R>

Parameters:

T – type of the input to the function
R – type of the result of the function

It takes two value <T,R> where first one is input and last one is return type result. In this example I will show you how to use as method:

  • FunctionAsMethod.java:

Reference:

Leave a Reply

Your email address will not be published. Required fields are marked *