title: Java, How do I get current index/key in "for each" loop
body: <p>In Java, How do I get the current index for the element in Java?</p>
  
  <pre><code>for (Element song: question){
      song.currentIndex();         //&lt;&lt;want the current index.
  }
  </code></pre>
  
  <p>In PHP you could do this:</p>
  
  <pre><code>foreach ($arr as $index =&gt; $value) {
      echo "Key: $index; Value: $value";
  }
  </code></pre>