1   /*
2    * %W% %E%
3    *
4    * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
5    * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6    */
7   
8   package java.util;
9   
10  /**
11   * An object that implements the Enumeration interface generates a
12   * series of elements, one at a time. Successive calls to the
13   * <code>nextElement</code> method return successive elements of the
14   * series.
15   * <p>
16   * For example, to print all elements of a <tt>Vector&lt;E&gt;</tt> <i>v</i>:
17   * <pre>
18   *   for (Enumeration&lt;E&gt; e = v.elements(); e.hasMoreElements();)
19   *       System.out.println(e.nextElement());</pre>
20   * <p>
21   * Methods are provided to enumerate through the elements of a
22   * vector, the keys of a hashtable, and the values in a hashtable.
23   * Enumerations are also used to specify the input streams to a
24   * <code>SequenceInputStream</code>.
25   * <p>
26   * NOTE: The functionality of this interface is duplicated by the Iterator
27   * interface.  In addition, Iterator adds an optional remove operation, and
28   * has shorter method names.  New implementations should consider using
29   * Iterator in preference to Enumeration.
30   *
31   * @see     java.util.Iterator
32   * @see     java.io.SequenceInputStream
33   * @see     java.util.Enumeration#nextElement()
34   * @see     java.util.Hashtable
35   * @see     java.util.Hashtable#elements()
36   * @see     java.util.Hashtable#keys()
37   * @see     java.util.Vector
38   * @see     java.util.Vector#elements()
39   *
40   * @author  Lee Boynton
41   * @version %I%, %G%
42   * @since   JDK1.0
43   */
44  public interface Enumeration<E> {
45      /**
46       * Tests if this enumeration contains more elements.
47       *
48       * @return  <code>true</code> if and only if this enumeration object
49       *           contains at least one more element to provide;
50       *          <code>false</code> otherwise.
51       */
52      boolean hasMoreElements();
53  
54      /**
55       * Returns the next element of this enumeration if this enumeration
56       * object has at least one more element to provide.
57       *
58       * @return     the next element of this enumeration.
59       * @exception  NoSuchElementException  if no more elements exist.
60       */
61      E nextElement();
62  }
63