Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
As detailed in the Java Language Specification \[[JLS 2005|AA. Bibliography#JLS 05]\], Section 14.14.2, "The enhancedEnhanced forFor statement"Statement 

an enhanced for statement of the form

Code Block
for (ObjType obj : someIterableItem) { 
  // ...
}

is equivalent to a standard for loop of the form

Code Block
for (Iterator myIterator = someIterableItem.iterator(); iterator.hasNext();) {
  ObjType obj = myIterator.next();
  // ...
}

...