< prev index next >
src/java.base/share/classes/java/util/Enumeration.java
Print this page
*** 26,47 ****
package java.util;
/**
* An object that implements the Enumeration interface generates a
* series of elements, one at a time. Successive calls to the
! * <code>nextElement</code> method return successive elements of the
* series.
* <p>
! * For example, to print all elements of a <tt>Vector<E></tt> <i>v</i>:
* <pre>
* for (Enumeration<E> e = v.elements(); e.hasMoreElements();)
* System.out.println(e.nextElement());</pre>
* <p>
* Methods are provided to enumerate through the elements of a
* vector, the keys of a hashtable, and the values in a hashtable.
* Enumerations are also used to specify the input streams to a
! * <code>SequenceInputStream</code>.
*
* @apiNote
* The functionality of this interface is duplicated by the {@link Iterator}
* interface. In addition, {@code Iterator} adds an optional remove operation,
* and has shorter method names. New implementations should consider using
--- 26,47 ----
package java.util;
/**
* An object that implements the Enumeration interface generates a
* series of elements, one at a time. Successive calls to the
! * {@code nextElement} method return successive elements of the
* series.
* <p>
! * For example, to print all elements of a {@code Vector<E>} <i>v</i>:
* <pre>
* for (Enumeration<E> e = v.elements(); e.hasMoreElements();)
* System.out.println(e.nextElement());</pre>
* <p>
* Methods are provided to enumerate through the elements of a
* vector, the keys of a hashtable, and the values in a hashtable.
* Enumerations are also used to specify the input streams to a
! * {@code SequenceInputStream}.
*
* @apiNote
* The functionality of this interface is duplicated by the {@link Iterator}
* interface. In addition, {@code Iterator} adds an optional remove operation,
* and has shorter method names. New implementations should consider using
*** 63,75 ****
*/
public interface Enumeration<E> {
/**
* Tests if this enumeration contains more elements.
*
! * @return <code>true</code> if and only if this enumeration object
* contains at least one more element to provide;
! * <code>false</code> otherwise.
*/
boolean hasMoreElements();
/**
* Returns the next element of this enumeration if this enumeration
--- 63,75 ----
*/
public interface Enumeration<E> {
/**
* Tests if this enumeration contains more elements.
*
! * @return {@code true} if and only if this enumeration object
* contains at least one more element to provide;
! * {@code false} otherwise.
*/
boolean hasMoreElements();
/**
* Returns the next element of this enumeration if this enumeration
< prev index next >