This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> numbers.stream().collect(Collectors.groupingBy(i -> i % 2, Collectors.filtering(j -> j > 5, Collectors.counting()))) | |
| $3 ==> {0=0, 1=3} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> numbers.stream().filter(j -> j > 5).collect(Collectors.groupingBy(i -> i % 2, Collectors.counting())) | |
| $2 ==> {1=3} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> List<Integer> numbers = List.of(2, 3, 4, 7, 9, 11) | |
| numbers ==> [2, 3, 4, 7, 9, 11] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> Stream.ofNullable(null).count() | |
| $4 ==> 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> Stream.ofNullable(null) | |
| $3 ==> java.util.stream.ReferencePipeline$Head@72b6cbcc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> Stream.of(null) | |
| | Warning: | |
| | non-varargs call of varargs method with inexact argument type for last parameter; | |
| | cast to java.lang.Object for a varargs call | |
| | cast to java.lang.Object[] for a non-varargs call and to suppress this warning | |
| | Stream.of(null) | |
| | ^--^ | |
| | java.lang.NullPointerException thrown: | |
| | at Arrays.stream (Arrays.java:5610) | |
| | at Stream.of (Stream.java:1187) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> Stream.of(1) | |
| $1 ==> java.util.stream.ReferencePipeline$Head@4566e5bd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> IntStream.iterate(0, i -> i < 10, i -> i + 2).forEach(System.out::println) | |
| 0 | |
| 2 | |
| 4 | |
| 6 | |
| 8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> IntStream.iterate(0, i -> i + 2).filter(j -> j < 10).forEach(System.out::println) | |
| 0 | |
| 2 | |
| 4 | |
| 6 | |
| 8 | |
| -2147483648 | |
| -2147483646 | |
| -2147483644 | |
| -2147483642 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jshell> IntStream.iterate( | |
| Signatures: | |
| IntStream IntStream.iterate(int seed, IntUnaryOperator f) | |
| IntStream IntStream.iterate(int seed, IntPredicate hasNext, IntUnaryOperator next) | |
| <press tab again to see documentation> |