title: Java 8 parallel forEach progress indication
body: <p>For performance reason I would like to use a forEach loop of a parallel Lambda stream in order to process an instance of a <code>Collection</code> in Java. As this runs in a background <code>Service</code> I would like to use the <code>updateProgress(double,double)</code> method in order to inform the user about the current progress.</p>
  
  <p>In order to indicate the current progress I need a certain progress indicator in form of a <code>Integer</code> counter. However, this is not possible as I can only access <code>final</code> variables within the Lambda expression.</p>
  
  <p>Code example see below, <code>Collection</code> is only a place holder for any possible instance of a <code>Collection</code>:</p>
  
  <pre><code>int progress = 0;
  Collection.parallelStream().forEach(signer -&gt; {
     progress++;
     updateProgress(progress, Collection.size());     
  });
  </code></pre>
  
  <p>I'm aware that I can solve this problem by using a simple for-loop. However, for performance reason it would nice to solve it in this way.</p>
  
  <p>Does anybody know a more or less neat solution to this?</p>