title: Java Stream: difference between forEach and forEachOrdered
body: <p><strong>Premise</strong>: I've already read <a href="https://stackoverflow.com/questions/32797579/foreach-vs-foreachordered-in-java-8-stream">this question</a> and others, but I need some clarifications.</p>
  
  <p>I understand that <code>Stream.forEach</code> method makes the difference (not only) when dealing with parallel streams, and this explains why this</p>
  
  <pre><code>//1
  Stream.of("one ","two ","three ","four ","five ","six ")
  .parallel()
  .forEachOrdered(item -&gt; System.out.print(item));
  </code></pre>
  
  <p>prints</p>
  
  <pre><code>one two three four five six
  </code></pre>
  
  <p>But when it comes to intermediate operations, the order is not guaranteed anymore when stream is parallelized. So this code</p>
  
  <pre><code>//2
  Stream.of("one ","two ","three ","four ","five ","six ")
  .parallel()
  .peek(item -&gt; System.out.print(item))
  .forEachOrdered(item -&gt; System.out.print(""));
  </code></pre>
  
  <p>will print something like</p>
  
  <pre><code>four six five one three two 
  </code></pre>
  
  <p>Is it correct to say that <code>forEachOrdered</code> method only affects order of elements in its own execution? Intuitively, I'm thinking of <code>//1</code> example being exactly the same as</p>
  
  <pre><code>//3
  Stream.of("one ","two ","three ","four ","five ","six ")
  .parallel()
  .peek(item -&gt; System.out.print("")) //or any other intermediate operation
  .sequential()
  .forEach(item -&gt; System.out.print(item));
  </code></pre>
  
  <p>Is my intuition wrong? Am I missing something about the whole mechanism?</p>