In Java 8, the streams API is easy to iterate over collections, and it's easy to parallelize a stream by calling the parallelStream()
method. But should we be using parallelStream()
wherever we can? What are the considerations?
You may also like: Think Twice Before Using Java 8 Parallel Streams
Look at the following ParallelStreamTester
class to generate collections of different sizes for the purpose of testing parallel streams performance against a sequential stream.