I would like to know what are the advantages of Enhanced for loop and Iterators in Java +5 ?
I would like to know what are the advantages of Enhanced for loop and Iterators in Java +5 ?
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...