Skip to content

Commit 7fc1fc0

Browse files
committed
Supplier Method
1 parent 1596e0d commit 7fc1fc0

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed
542 Bytes
Binary file not shown.

bin/revise/lambdas/StringConcat.class

0 Bytes
Binary file not shown.

src/revise/lambdas/LambdasExamples1.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.util.function.Consumer;
1111
import java.util.function.Function;
1212
import java.util.function.Predicate;
13+
import java.util.function.Supplier;
1314
import java.util.function.UnaryOperator;
1415
import java.util.stream.Collectors;
1516
import java.util.stream.Stream;
@@ -34,6 +35,17 @@ public static void main(String args[]) {
3435
example7();
3536
example8();
3637
example9();
38+
example10();
39+
40+
}
41+
42+
public static void example10() {
43+
System.out.println("Supplier Method");
44+
List<Student> listStudents = StudentDB.getAllStudents();
45+
listStudents.forEach(student -> {
46+
Supplier<String> getName = student::getName;
47+
System.out.println(getName.get());
48+
});
3749

3850
}
3951

0 commit comments

Comments
 (0)