• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enumeration

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could anyone be kind enough to elaborate on the concept of Enumeration?
Your help will be greatly appreciated.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I think of enumeration, I think of traversing the contents of a collection. Enumeration and Iteratation are an abstraction such that you don't have to worry about the collection's underlying structure. For instance, traversing a Vector is easy to manage because it's implemented as a dynamic array and, as such, you can use an index. But, to walk a linked list or a set, things are a bit different...
Using Java's enumeration/iteration abstraction, you can use a common interface to traverse various types of collections.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic