Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Java in General and the fly likes Enumerator Vs Iterator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Enumerator Vs Iterator" Watch "Enumerator Vs Iterator" New topic

Enumerator Vs Iterator


Joined: Jun 08, 2006
Posts: 24

What is the difference between Enumerator and Iterator?
Where we use Enumarator and where we use Iterator?

Any one Please help me...
naidu gulla

Joined: Jul 19, 2006
Posts: 14
The main difference is Enumerator does not provide a standard method for
for removing tehe objects.
Iterator has provided method for removing the objects.
Arafat Nalkhande
Ranch Hand

Joined: Jul 20, 2006
Posts: 51
Well to start off with there is no class/interface in java called as Enumerator. Though there is Interface called Enumeration.

Iterator takes the place of Enumeration in the Java collections framework. Iterators differ from enumerations in two ways:

1) Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics.
2) Method names have been improved.

I want to be myself, but a better myself.<br />~ SCJP 1.4 (91%), SCWCD 1.4 (86%) ~
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
This thread
I agree. Here's the link:
subject: Enumerator Vs Iterator
It's not a secret anymore!