What are the advantages of Enhanced for loop and Iterator in Java?

Viewed 33854

I would like to know what are the advantages of Enhanced for loop and Iterators in Java +5 ?

12 Answers

Major drawback is the creation of an Iterator, which is not there with an index-based loop. It is usually OK, but in performance-critical sections (in a real-time application for instance, when it has to run several hundreds times a second), it can cause major GC intervention...

Related