0

Which is the best loop, Enhanced for loop (or) for loop in java.

12th Oct 2019, 3:33 PM
Balaji
Balaji - avatar
2 Réponses
0
"That's all about the difference between for loop and enhanced for loop in Java. If you only want to iterate over elements from an array or a collection e.g. a list or a set then use enhanced for loop, it's convenient and less error prone, but if you want more control over iteration process then use traditional for loop"
12th Oct 2019, 3:54 PM
Daniel (kabura)
Daniel (kabura) - avatar
0
performance of both is same
12th Oct 2019, 9:02 PM
zemiak