Sunday, 17 April 2011

What is the difference between Enumeration and Iterator?

EnumerationIterator
Enumeration doesn't have a remove() methodIterator has a remove() method
Enumeration acts as Read-only interface, because it has the methods only to traverse and fetch the objectsCan be abstract, final, native, static, or synchronized
Note: So Enumeration is used whenever we want to make Collection objects as Read-only.

No comments:

Post a Comment