Originally posted by Aarti Dahiya:
Figure 7.4 in K&B book is all that it gives about Iterator. Is that all I need to know? What about Enumeration?
Thanks.
Yes, Iterators can appear on the exam. The
Iterator interface declares only three methods, so it is very easy to learn. The
Enumeration interface only declares two methods, so it is even easier.
The Iterator and Enumeration interfaces are very similar. One obvious difference is that Iterators have three methods while Enumerations have only two. A second difference is that the methods of the Iterator interface have shorter names than those of the Enumeration interface.
The Enumeration is really a legacy interface.
You should always use Iterators in new designs.
Whenever you work with Collection classes, you are likely to be working with Iterators, so you should not hesitate to learn how to use them. Learning how to use Collection classes without learning about Iterators is about as useful as learning how to work with screws without also learning how to use a screw driver.
[ August 09, 2004: Message edited by: Dan Chisholm ]