Square CSS

Monday, May 25, 2020

Supplier : Functional Interface Java 8

Introduction


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

Refer The video Tutorial for detail


 

Use Case 


Supplier is a functional interface which is used to return data without accepting anything as parameter.The sample code is shown below.




    //this accepts an argument & return a result. Supplier<String> supplier=new Supplier<String>() { @Override public String get() { return "Data from supplier functional interface "; } };


The above case Supplier will not receive anything but return the result. The function is returning a String.


Conclusion 


In this tutorial we saw the use case of functional interface - Supplier. which is introduced in java 8 to act as supplier without receiving any parameter. 

1 comment:

  1. Hi any way I can reach you. Could u pls provide your email account? I have few questions and I would like to send it across

    ReplyDelete

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