title: Is there a way to access an iteration-counter in Java's for-each loop?
body: <p>Is there a way in Java's for-each loop</p>
  
  <pre><code>for(String s : stringArray) {
    doSomethingWith(s);
  }
  </code></pre>
  
  <p>to find out how often the loop has already been processed?</p>
  
  <p>Aside from using the old and well-known <code>for(int i=0; i &lt; boundary; i++)</code> - loop, is the construct</p>
  
  <pre><code>int i = 0;
  for(String s : stringArray) {
    doSomethingWith(s);
    i++;
  }
  </code></pre>
  
  <p>the only way to have such a counter available in a for-each loop?</p>