WHAT IS THE DIFFERENCE BETWEEN ENUMERATION AND ITERATOR?

Amit Singh

Total Post:565

Points:2825
Posted by  Amit Singh
Java 
 1211  View(s)
Ratings:
Rate this:
  1. Amit Singh

    Post:565

    Points:2825
    What is the difference between Enumeration and Iterator?

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!