Java Reference
In-Depth Information
Figure 8.4. Examining values flowing in a stream pipeline with peek
In the following code, you use peek to print the intermediate value before and after each
operation in the stream pipeline:
This will produce a useful output at each step of the pipeline:
from stream: 2
after map: 19
from stream: 3
after map: 20
after filter: 20
after limit: 20
from stream: 4
after map: 21
from stream: 5
after map: 22
after filter: 22
after limit: 22
 
Search WWH ::




Custom Search