aspose file tools*
The moose likes Beginning Java and the fly likes Enumeration Vs Iterator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Enumeration Vs Iterator" Watch "Enumeration Vs Iterator" New topic
Author

Enumeration Vs Iterator

pravin suroshe
Greenhorn

Joined: Jan 13, 2005
Posts: 8
Hi all,
I am new to java tech. Can anyone explain me the difference between Enumeration and Iterator, when should I use enumeration and when Iterator. Any help would be appreciated.

Thanx in advance.
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
To the best of my knowledge Enumeration is a throwback to older Java versions. At some point there was the decision to move to the Iterator pattern (this may have had something to do with the GOF book, not sure). However to keep the 'not breaking backwards compatability' contract the Enumerations were left in. I don't think there is a big difference, although Iterator is the 'prefered' way to go.

My memory is sketchy on this so I may be off.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enumeration Vs Iterator