01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package java.util;
28:
29: /**
30: * An object that implements the Enumeration interface generates a
31: * series of elements, one at a time. Successive calls to the
32: * <code>nextElement</code> method return successive elements of the
33: * series.
34: * <p>
35: * For example, to print all elements of a vector <i>v</i>:
36: * <blockquote><pre>
37: * for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
38: * System.out.println(e.nextElement());<br>
39: * }
40: * </pre></blockquote>
41: * <p>
42: * Methods are provided to enumerate through the elements of a
43: * vector, the keys of a hashtable, and the values in a hashtable.
44: *
45: * @version 12/17/01 (CLDC 1.1)
46: * @see java.util.Enumeration#nextElement()
47: * @see java.util.Hashtable
48: * @see java.util.Hashtable#elements()
49: * @see java.util.Hashtable#keys()
50: * @see java.util.Vector
51: * @see java.util.Vector#elements()
52: * @since JDK1.0, CLDC 1.0
53: */
54: public interface Enumeration {
55:
56: /**
57: * Tests if this enumeration contains more elements.
58: *
59: * @return <code>true</code> if and only if this enumeration object
60: * contains at least one more element to provide;
61: * <code>false</code> otherwise.
62: */
63: boolean hasMoreElements();
64:
65: /**
66: * Returns the next element of this enumeration if this enumeration
67: * object has at least one more element to provide.
68: *
69: * @return the next element of this enumeration.
70: * @exception NoSuchElementException if no more elements exist.
71: */
72: Object nextElement();
73: }
|