title: What is a difference between traditional loop and for-each loop?
body: <p>I wonder if there is a difference between these:</p>
  
  <pre><code>ArrayList&lt;Example&gt; list = new ArrayList&lt;Example&gt;
  </code></pre>
  
  <p>1-)</p>
  
  <pre><code>for(int i = 0; i &lt; list.size(); i++) {
      list.get(i).doSomething();
  }
  </code></pre>
  
  <p>2-)</p>
  
  <pre><code>for(Example example : list) {
      example.doSomething();
  }
  </code></pre>
  
  <p>If there is not any difference which one is more common or efficient?</p>