What’s the difference between Enumeration and Iterator interfaces?

Technology CommunityCategory: JavaWhat’s the difference between Enumeration and Iterator interfaces?
VietMX Staff asked 4 years ago

Enumeration is twice as fast as compared to an Iterator and uses very less memory. However, the Iterator is much safer compared to Enumeration, because other threads are not able to modify the collection object that is currently traversed by the iterator. Also, Iterators allow the caller to remove elements from the underlying collection, something which is not possible with Enumeration.