java.util

Interface Enumeration<E>

public interface Enumeration<E>

Interface for lists of objects that can be returned in sequence. Successive objects are obtained by the nextElement method.

As of Java 1.2, the Iterator interface provides the same functionality, but with shorter method names and a new optional method to remove items from the list. If writing for 1.2, consider using Iterator instead. Enumerations over the new collections classes, for use with legacy APIs that require them, can be obtained by the enumeration method in class Collections.

Since: 1.0

See Also: Iterator Hashtable Vector

UNKNOWN: updated to 1.4

Method Summary
booleanhasMoreElements()
Tests whether there are elements remaining in the enumeration.
EnextElement()
Obtain the next element in the enumeration.

Method Detail

hasMoreElements

public boolean hasMoreElements()
Tests whether there are elements remaining in the enumeration.

Returns: true if there is at least one more element in the enumeration, that is, if the next call to nextElement will not throw a NoSuchElementException.

nextElement

public E nextElement()
Obtain the next element in the enumeration.

Returns: the next element in the enumeration

Throws: NoSuchElementException if there are no more elements