• Post Reply Bookmark Topic Watch Topic
  • New Topic

Iterator, Comparator  RSS feed

 
Sachin Ramesh Vir
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What is Iterator, Comparator and Enumerator? I am always confused these two things. I really appreciate if someone provide me the coding that explains iterator and comparator and enumerator
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iterators and enumerators have the same job function; to walk through a collection of data objects one element at a time. That's it.

The reason they are described so generally in some documentation is that the interfaces hide the details of how they work. This is intended to keep the use of such objects clear without requring an understanding of the implementation. Unfortunately, it also makes things a bit harder to work out, if you're learning.

Read a tutorial on the Collections API for a full treatment.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case you need some links, you can find some useful information on the following web pages:

The Java Tutorial (including The Collections Trail)
The Java API documentation

These are both very useful links, so you should bookmark them. I especially encourage you to learn how to navigate the API docs. If you know what documentation is already available and how to use it, you will be able to find the answers to similar questions on your own in the future.

Layne
[ September 20, 2005: Message edited by: Layne Lund ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!