aspose file tools*
The moose likes Java in General and the fly likes iterator vs Enumeration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "iterator vs Enumeration" Watch "iterator vs Enumeration" New topic
Author

iterator vs Enumeration

vara prasad
Ranch Hand

Joined: Dec 21, 2004
Posts: 47
what is the difference between iterator and Enumeration
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Iterator is newer than Enumeration, and its method names are shorter because it was felt that the old ones were too long and awkward. Also, Iterator has an optional method that lets you remove the current element from a collection -- Enumeration doesn't have that.

In any case, Iterator is meant as a replacement for Enumeration. You shouldn't use Enumeration unless you're forced to by a legacy API.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: iterator vs Enumeration
 
Similar Threads
enum
Iterator vs Enumeration
Iterator vs Enumeration
enumeratio or iterator
enumeration and iterator difference