`peek()`Stream
`sorted()`Spliterator`SORTED``sorted()`""
2`peek`
IntStream stream = IntStream.of(1, 2, 3);
stream.forEach(i -> System.out.println("1st: " + i))
stream = IntStream.of(1, 2, 3);
stream.peek(i -> System.out.println("2nd: " + i))
.peek(i -> System.out.println("3rd: " + i))
.sum();
* * *
>
(`toArray()`)Stream""
IntStream stream = IntStream.of(1, 2, 3);
IntStream.of(
stream
.map(x -> x * 2)
.peek(i -> System.out.println("1st: " + i)) // for DEBUG
.toArray()
)
.peek(i -> System.out.println("2nd: " + i)) // for DEBUG
.peek(i -> System.out.println("3rd: " + i)) // for DEBUG
.sum();