11 ms·
I don't think the stateful approach with .generate() is thread-safe if you make the stream parallel. The API doc says it's an unordered stream, parallelizing it
by the8472 8y ago
I don't think the stateful approach with .generate() is thread-safe if you make the stream parallel. The API doc says it's an unordered stream, parallelizing it would mean concurrent reads/writes in the supplier.
Stream.iterate() docs on the other hand guarantee happens-before ordering for invocations.