title: Parallelism with Streams created from Iterators
body: <p>Experimenting with streams I ran into the following behavior which I don't quite understand. I created a parallel stream from an iterator and I noticed that it did not seem to be exhibiting parallelism. In the below example I've printed a counter to the console for two parallel streams, one created from an iterator and the other from a list. The stream created from the list exhibited the behavior I expected which was to print the counter in non-sequential order but the stream created from the iterator printed the counter in sequential order. Am I creating the parallel stream from an iterator incorrectly?</p>
  
  <pre><code>    private static int counter = 0;
  
  public static void main(String[] args) {
      List&lt;Integer&gt; lstr = IntStream.rangeClosed(1, 100).boxed().collect(Collectors.toList());
      Iterator&lt;Integer&gt; iter = lstr.iterator();
  
      System.out.println("Iterator Stream: ");
      StreamSupport.stream(Spliterators.spliteratorUnknownSize(iter, Spliterator.IMMUTABLE | Spliterator.CONCURRENT), true).forEach(i -&gt; {
          System.out.print(counter + " ");
          counter++;
      });
  
      counter = 0;
      System.out.println("\nList Stream: ");
      lstr.parallelStream().forEach(i -&gt; {
          System.out.print(counter + " ");
          counter++;
      });
  
  }
  </code></pre>