1 *java.util.Iterator* *Iterator* An iterator over a collection.
3 public interface interface Iterator<E>
6 |java.util.Iterator_Description|
7 |java.util.Iterator_Fields|
8 |java.util.Iterator_Constructors|
9 |java.util.Iterator_Methods|
11 ================================================================================
13 *java.util.Iterator_Methods*
14 |java.util.Iterator.hasNext()|Returns true if the iteration has more elements.
15 |java.util.Iterator.next()|Returns the next element in the iteration.
16 |java.util.Iterator.remove()|Removes from the underlying collection the last el
18 *java.util.Iterator_Description*
20 An iterator over a collection. Iterator takes the place of Enumeration in the
21 Java collections framework. Iterators differ from enumerations in two ways:
22 Iterators allow the caller to remove elements from the underlying collection
23 during the iteration with well-defined semantics. Method names have been
26 This interface is a member of the <a
27 href="/../technotes/guides/collections/index.html"> Java Collections Framework.
31 *java.util.Iterator.hasNext()*
33 public boolean hasNext()
35 Returns true if the iteration has more elements. (In other words, returns true
36 if next would return an element rather than throwing an exception.)
40 Returns: true if the iterator has more elements.
42 *java.util.Iterator.next()*
46 Returns the next element in the iteration.
50 Returns: the next element in the iteration.
52 *java.util.Iterator.remove()*
56 Removes from the underlying collection the last element returned by the
57 iterator (optional operation). This method can be called only once per call to
58 next. The behavior of an iterator is unspecified if the underlying collection
59 is modified while the iteration is in progress in any way other than by calling