FileDocCategorySizeDatePackage
Iterator.javaAPI DocAndroid 1.5 API2584Wed May 06 22:41:04 BST 2009java.util

Iterator

public 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.
since
Android 1.0

Fields Summary
Constructors Summary
Methods Summary
public booleanhasNext()
Returns whether there are more elements to iterate, i.e. whether the iterator is positioned in front of an element.

return
{@code true} if there are more elements, {@code false} otherwise.
see
#next
since
Android 1.0

public Enext()
Returns the next object in the iteration, i.e. returns the element in front of the iterator and advances the iterator by one position.

return
the next object.
throws
NoSuchElementException if there are no more elements.
see
#hasNext
since
Android 1.0

public voidremove()
Removes the last object returned by {@code next} from the collection. This method can only be called once after {@code next} was called.

throws
UnsupportedOperationException if removing is not supported by the collection being iterated.
throws
IllegalStateException if {@code next} has not been called, or {@code remove} has already been called after the last call to {@code next}.
since
Android 1.0