About Question enthuware.ocpjp.v8.2.1897 :
Posted: Wed Dec 23, 2015 6:38 am
When I read this the first time I thought that the whole stream was going to operate in a parallel way (multiple threads in parallel) until a call to sequential() happens.Making the stream parallel will cause the filter operations to be processed by multiple threads. Making it sequential again will assure that the elements in the final stream will have the same order as the original.
I made some tests, and seems like having both parallel() and sequential() is actually like not having anything at all, becase the whole stream will be sequential (no multithreading involved): the last statement, sequential in this case, will overwrite the previously defined behavior (parallel) affecting all the intermediate operations.
Correct me if I'm wrong, maybe description here is a bit misleading, because in fact no multithreading is involved in filter operations.