File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enumeration interface

 
Saumya Tangeda
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is this related to collections and maps?
 
Daniel Adornes
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Saumya Tangeda
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Daniel.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic