Skip to content

Commit 3666ece

Browse files
committed
Add sample
1 parent 3806164 commit 3666ece

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/com/winterbe/java8/Streams5.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.Arrays;
44
import java.util.List;
5+
import java.util.function.Supplier;
56
import java.util.stream.Stream;
67

78
/**
@@ -20,8 +21,19 @@ public static void main(String[] args) {
2021
// test3(strings);
2122
// test4(strings);
2223
// test5(strings);
23-
test6(strings);
24+
// test6(strings);
2425
// test7(strings);
26+
test8(strings);
27+
}
28+
29+
private static void test8(List<String> stringCollection) {
30+
Supplier<Stream<String>> streamSupplier =
31+
() -> stringCollection
32+
.stream()
33+
.filter(s -> s.startsWith("a"));
34+
35+
streamSupplier.get().anyMatch(s -> true);
36+
streamSupplier.get().noneMatch(s -> true);
2537
}
2638

2739
// stream has already been operated upon or closed

0 commit comments

Comments
 (0)