Iteratorpublic interface Iterator An Iterator is used to sequence over a collection of objects. Conceptual, an
iterator is always positioned between two elements of a collection. A fresh
iterator is always positioned in front of the first element.
If a collection has been changed since its creation, methods {@code next} and
{@code hasNext()} may throw a {@code ConcurrentModificationException}.
Iterators with this behavior are called fail-fast iterators. |
Methods Summary |
---|
public boolean | hasNext()Returns whether there are more elements to iterate, i.e. whether the
iterator is positioned in front of an element.
| public E | next()Returns the next object in the iteration, i.e. returns the element in
front of the iterator and advances the iterator by one position.
| public void | remove()Removes the last object returned by {@code next} from the collection.
This method can only be called once after {@code next} was called.
|
|