Square CSS

Monday, May 25, 2020

Function : Functional Interface Java 8

Introduction


In this tutorial we will look at the use of Function a functional interface introduced in java 8.

Refer The video Tutorial for detail


 

Use Case 


Function is a functional interface which accepts one argument and returns another.The sample code is shown below.


    //this interface accepts one argument and return one result. Function<Integer,String> function=new Function<Integer,String>() { @Override public String apply(Integer t) { return "The data is: "+t; } }


The above case Function will receive one argument and return one result. The function is receiving Integer t and returning a String.

Conclusion 


In this tutorial we saw the use case of functional interface - Function. which is introduced in java 8 as request response perimeter.

No comments:

Post a Comment

Some Algorithms

Algorithm: Tower of Hanoi

Tower of Hanoi consists of three towers called as pegs with n number of rings. Rings are of different size.  Conditions to be fulfill...

Popular Posts