Home > DeveloperSection > Interviews > What is the difference between Enumeration and Iterator?

Posted on    April-16-2011 1:08 AM

 Java Java 
Ratings:
 1 Answer(s)
  977  View(s)
Rate this:

Amit Singh

Total Post:565

Points:2825
Posted on    April-16-2011 12:00 AM

The functionality of Enumeration interface is duplicated by the Iterator interface. Iterator has a remove() method while Enumeration doesn't. Enumeration acts as Read-only interface, because it has the methods only to traverse and fetch the objects, where as using Iterator we can manipulate the objects also like adding and removing the objects. So Enumeration is used when ever we want to make Collection objects as Read-only.

Don't want to miss updates? Please click the below button!

Follow MindStick