What are advantages of iterating a collection using iterator?

Solution

For loop does not allow the updation in the array(add or remove operation) inside the loop whereas Iterator does. Also Iterator can be used where there is no clue what type of collections will be used because all collections have iterator.

Share this thread

Comments

Comments
comments powered by Disqus

Navigation

Social Media