Both
Iterator and Enumeration are used to traverse Collection objects, in a
sequential fashion. Enumeration can be applied to Vector and HashTable.
Iterator can be used with most of the Collection objects.
The
main difference between the two is that Iterator is fail-safe. i.e, If
you are using an iterator to go through a collection you can be sure of
no concurrent modifications in the underlying collection which may
happen in multi-threaded environments.
Posted in: