0 votes
in JAVA by
What is the parallel Stream? How can you get a parallel stream from a List?

1 Answer

0 votes
by

A parallel stream can parallel execute stream processing tasks. For example, if you have a parallel stream of 1 million orders and you are looking for orders worth more than 1 million, then you can use a filter to do that.

Unlike sequential Stream, the parallel Stream can launch multiple threads to search for those orders on the different part of Stream and then combine the result.

In short, the parallel Stream can paralyze execution, but, as Cay S. Horstman mentioned in Core Java S.E. 9 for the Impatient, there is significant overhead or parallelism, which only pays off if you are doing bulk data operation.

Related questions

0 votes
asked Feb 28, 2023 in JAVA by rajeshsharma
0 votes
asked May 31, 2022 in JAVA by Robin
...