Module java.base
Package java.util

Interface Iterator<E>

Type Parameters:
E - the type of elements returned by this iterator
All Known Subinterfaces:
ListIterator<E>, PrimitiveIterator<T,T_CONS>, PrimitiveIterator.OfDouble, PrimitiveIterator.OfInt, PrimitiveIterator.OfLong, XMLEventReader
All Known Implementing Classes:
BeanContextSupport.BCSIterator, EventReaderDelegate, Scanner

public interface Iterator<E>
An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Framework. Iterators differ from enumerations in two ways:
  • Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics.
  • Method names have been improved.

This interface is a member of the Java Collections Framework.

API Note:
An Enumeration can be converted into an Iterator by using the Enumeration.asIterator() method.
See Also: