Hacker News new | ask | show | jobs
by delusional 962 days ago
> My favorite is that sequential streams can be efficiently parallelized with a single operation, .parallel(), and sequentialized back, .sequential()

That's not actually true. .parallel and .sequential set a state flag for the entire stream. A stream that is opened, parallelized, then sequentalized, will actually just execute sequentially [1]

[1]: https://docs.oracle.com/en/java/javase/14/docs/api/java.base...