title: Java foreach loop: for (Integer i : list) { ... }
body: <p>When I use JDK5 like below</p>
  
  <pre><code>ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();  
       for (Integer i : list) { 
  
        //cannot check if already reached last item
  
     }
  </code></pre>
  
  <p>on the other hand if I just use an <code>Iterator</code></p>
  
  <pre><code>ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
    for (Iterator i = list.iterator(); i.hasNext();) {
  
            //i can check whether this is last item
            if(i.hasNextItem()){
            }
  
      }
  </code></pre>
  
  <p>How can I check if I've already reached last item with   <code>for (Integer i : list) {</code></p>