Enumeration Interface
Home ] Up ] Vector Class ] [ Enumeration Interface ] Vector/Enumeration Example ]

 

 

Enumeration is an interface which allows you to enumerate through a collection of items:

Enumeration
package java.util;

/* Comments omitted */
public interface Enumeration 
{
    /**
     * Tests if this enumeration contains more elements.
     *
     * @return  <code>true</code> if this enumeration contains more elements;
     *          <code>false</code> otherwise.
     * @since   JDK1.0
     */
    boolean hasMoreElements();

    /**
     * Returns the next element of this enumeration.
     *
     * @return     the next element of this enumeration. 
     * @exception  NoSuchElementException  if no more elements exist.
     * @since      JDK1.0
     */
    Object nextElement();
}

Vector's elements() method returns an instance of a class that implements the Enumeration interface.

Note that Enumeration is being replaced by Iterator.  (see later).

 

This page was last modified on 02 October, 2007