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

Difference between enuernation and Iterator in Java Collection.

Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 387
Hi,

As we know Enumeration is deprecated Interface in Java Collection..

So what is the exact difference between enuernation and Iterator .


Please share !

Regards,
Prabhat
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Well, they're interfaces, so the only differences are the names and signatures of the methods. Iterator has shorter method names, which don't clutter your code as much, and it has the "remove()" method, which Enumeration lacks. That's it.


[Jess in Action][AskingGoodQuestions]
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 387
yes correct !

thanks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

Enumeration is not deprecated, it is merely discouraged. It's the same as Vector vs ArrayList.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between enuernation and Iterator in Java Collection.
 
Similar Threads
differences
Iterator vs Enumeration
enumeration and iterator difference
hashpmap and dictionary and hashtable?
iterator vs Enumeration