my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Enumeration interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Enumeration interface" Watch "Enumeration interface" New topic
Author

Enumeration interface

Saumya Tangeda
Greenhorn

Joined: Jul 09, 2006
Posts: 24
How is this related to collections and maps?
Daniel Adornes
Greenhorn

Joined: Jul 18, 2006
Posts: 7
Hi Saumya,

I don't know if I've really understood your question, but I could give you this example:

A Hashtable collection is indexed by keys and IS NOT ordered or "iteratable" (don't know if this term really exists) by itself. Therefore, to iterate through a Hashtable (traverse its elements) you may call the method elements() of the class Hashtable, and this method will return a Enumeration object.
Now, with a Enumeration object, you are able to traverse the elements of your Hashtable collection just using the methods of that interface, that are: nextElement() and hasMoreElements().

Hope I've helped you!


Daniel Adornes
Saumya Tangeda
Greenhorn

Joined: Jul 09, 2006
Posts: 24
Thanks Daniel.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enumeration interface