<p>What, if any, is the performance difference between the following two loops?</p>

<pre><code>for (Object o: objectArrayList) {
    o.DoSomething();
}
</code></pre>

<p>and </p>

<pre><code>for (int i=0; i&lt;objectArrayList.size(); i++) {
    objectArrayList.get(i).DoSomething();
}
</code></pre>

From Item 46 in
Effective Java
by Joshua Bloch :
The for-each loop, introduced in
  release 1.5, gets rid of the clutter
  and the opportunity for error by
  hiding the iterator or index variable
  completely. The resulting idiom
  applies equally to collections and
  arrays:
```
```
// The preferred idiom for iterating over collections and arrays
for (Element e : elements) {
    doSomething(e);
}
```
```
When you see the colon (:), read it as
  “in.” Thus, the loop above reads as
  “for each element e in elements.” Note
  that there is no performance penalty
  for using the for-each loop, even for
  arrays. In fact, it may offer a slight
  performance advantage over an ordinary
  for loop in some circumstances, as it
  computes the limit of the array index
  only once. While you can do this by
  hand (Item 45), programmers don’t
  always do so.