File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
Modern-Java-Examples/src/com/learn/functionalInterfaces Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .learn .functionalInterfaces ;
2
+
3
+ import com .learn .data .Student ;
4
+ import com .learn .data .StudentDataBase ;
5
+
6
+ import java .util .List ;
7
+ import java .util .function .Supplier ;
8
+
9
+ public class SupplierExample {
10
+
11
+ public static void main (String [] args ) {
12
+
13
+ Supplier <Student > supplier = () -> {
14
+ return StudentDataBase .getAllStudents ().get (0 );
15
+ };
16
+
17
+ System .out .println (supplier .get ());
18
+
19
+ Supplier <List <Student >> supplier1 = StudentDataBase ::getAllStudents ;
20
+ System .out .println (supplier1 .get ());
21
+ }
22
+ }
Original file line number Diff line number Diff line change @@ -15,6 +15,38 @@ This repository contains the basic & advance level examples related to Java
15
15
* [ BiFunction] ( Modern-Java-Examples/src/com/learn/functionalInterfaces/BiFunctionExample.java )
16
16
* [ UnaryOperator] ( Modern-Java-Examples/src/com/learn/functionalInterfaces/UnaryOperatorExample.java )
17
17
* [ BinaryOperator] ( Modern-Java-Examples/src/com/learn/functionalInterfaces/BinaryOperatorExample.java )
18
+ * [ Supplier] ( Modern-Java-Examples/src/com/learn/functionalInterfaces/SupplierExample.java )
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
18
50
19
51
20
52
You can’t perform that action at this time.
0 commit comments