File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 361
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: 24041
    
  13

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: 361
yes correct !

thanks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

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


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