Iterator

An iterator over a collection. {@code Iterator} takes the place of {@link Enumeration} in the Java Collections Framework. Iterators differ from enumerations in two ways:

<ul> <li> Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics. <li> Method names have been improved. </ul>

<p>This interface is a member of the <a href="{@docRoot}/../technotes/guides/collections/index.html"> Java Collections Framework</a>.

@param <E> the type of elements returned by this iterator

@author Josh Bloch @see Collection @see ListIterator @see Iterable

interface Iterator (
E
) {}

Members

Functions

hasNext
bool hasNext()

Returns {@code true} if the iteration has more elements. (In other words, returns {@code true} if {@link #next} would return an element rather than throwing an exception.)

next
E next()

Returns the next element in the iteration.

Meta