Java Reference
In-Depth Information
Listing C.1. Defining a StreamForker to execute multiple operations on a
stream
Here the fork method accepts two arguments:
A Function , which transforms the stream into a result of any type representing one of these
operations
A key, which will allow you to retrieve the result of that operation and accumulates these key/function
pairs in an internal Map
The fork method returns the StreamForker itself; therefore, you can build a pipeline by forking
several operations. Figure C.1 shows the main ideas behind the StreamForker.
 
Search WWH ::




Custom Search