Iterator is a replacement for the Enumeration class which was used before collections were added to Java.
Tutorial Details:
The List and Set collections provide iterators, which are objects that allow going over all the elements of a collection. The java.util.Iterator interface provides for one-way traversal and java.util.ListIterator provides two-way traversal. Iterator is a replacement for the Enumeration class which was used before collections were added to Java.
Creating an Iterator
Iterators are created by calling the iterator() or listIterator() method of a List or Set.
Iterator Methods
Iterator defines three methods, one of which is optional.
Rate Tutorial: http://www.roseindia.net/java/java-tips/data/collections_non_generic/50iterators.shtml
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: Iterators
View Tutorial: Iterators
Related
Tutorials:
|