What is the consequence of calling `parallel()` on a stream with a stateful intermediate operation like `sorted()`?

Java Hard
Select the correct answer: Single Choice

Key points

  • Stateful operations like `sorted()` require collecting all elements before proceeding in a parallel stream
  • This can reduce or eliminate the benefits of parallel execution
  • It may result in slower performance compared to sequential execution

Ready to go further?