Does Java's for-each call an embedded method (that returns the collection) for every iteration?

Viewed 9053

If there is a method call MyClass.returnArray() and I iterate over the array using the for-each construct (also called the "enhanced for" loop):

for (ArrayElement e : MyClass.returnArray()) {
   //do something
}

will then the returnArray() method be called for every iteration?

4 Answers
Related