What is the difference between Iterator and Enumeration?

Iterator
Enumeration
It is useful to retrieve object
From a collection
It’s also useful to retrieve object
From a collection
Iterator has methods whose
Names are easy to follow
Enumeration has methods whose
Names are difficult to remember
Iterator has an option to remove
Objects from a collection
Which is not available
So Iterator is preferred than Enumeration

No comments:

Post a Comment