jtulach@120: /*
jtulach@120: * Copyright (c) 1994, 2005, Oracle and/or its affiliates. All rights reserved.
jtulach@120: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jtulach@120: *
jtulach@120: * This code is free software; you can redistribute it and/or modify it
jtulach@120: * under the terms of the GNU General Public License version 2 only, as
jtulach@120: * published by the Free Software Foundation. Oracle designates this
jtulach@120: * particular file as subject to the "Classpath" exception as provided
jtulach@120: * by Oracle in the LICENSE file that accompanied this code.
jtulach@120: *
jtulach@120: * This code is distributed in the hope that it will be useful, but WITHOUT
jtulach@120: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jtulach@120: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jtulach@120: * version 2 for more details (a copy is included in the LICENSE file that
jtulach@120: * accompanied this code).
jtulach@120: *
jtulach@120: * You should have received a copy of the GNU General Public License version
jtulach@120: * 2 along with this work; if not, write to the Free Software Foundation,
jtulach@120: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jtulach@120: *
jtulach@120: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jtulach@120: * or visit www.oracle.com if you need additional information or have any
jtulach@120: * questions.
jtulach@120: */
jtulach@120:
jtulach@120: package java.util;
jtulach@120:
jtulach@120: /**
jtulach@120: * An object that implements the Enumeration interface generates a
jtulach@120: * series of elements, one at a time. Successive calls to the
jtulach@120: * nextElement
method return successive elements of the
jtulach@120: * series.
jtulach@120: *
jtulach@120: * For example, to print all elements of a Vector<E> v: jtulach@120: *
jtulach@120: * for (Enumeration<E> e = v.elements(); e.hasMoreElements();) jtulach@120: * System.out.println(e.nextElement());jtulach@120: *
jtulach@120: * Methods are provided to enumerate through the elements of a
jtulach@120: * vector, the keys of a hashtable, and the values in a hashtable.
jtulach@120: * Enumerations are also used to specify the input streams to a
jtulach@120: * SequenceInputStream
.
jtulach@120: *
jtulach@120: * NOTE: The functionality of this interface is duplicated by the Iterator
jtulach@120: * interface. In addition, Iterator adds an optional remove operation, and
jtulach@120: * has shorter method names. New implementations should consider using
jtulach@120: * Iterator in preference to Enumeration.
jtulach@120: *
jtulach@120: * @see java.util.Iterator
jtulach@120: * @see java.io.SequenceInputStream
jtulach@120: * @see java.util.Enumeration#nextElement()
jtulach@120: * @see java.util.Hashtable
jtulach@120: * @see java.util.Hashtable#elements()
jtulach@120: * @see java.util.Hashtable#keys()
jtulach@120: * @see java.util.Vector
jtulach@120: * @see java.util.Vector#elements()
jtulach@120: *
jtulach@120: * @author Lee Boynton
jtulach@120: * @since JDK1.0
jtulach@120: */
jtulach@120: public interface Enumerationtrue
if and only if this enumeration object
jtulach@120: * contains at least one more element to provide;
jtulach@120: * false
otherwise.
jtulach@120: */
jtulach@120: boolean hasMoreElements();
jtulach@120:
jtulach@120: /**
jtulach@120: * Returns the next element of this enumeration if this enumeration
jtulach@120: * object has at least one more element to provide.
jtulach@120: *
jtulach@120: * @return the next element of this enumeration.
jtulach@120: * @exception NoSuchElementException if no more elements exist.
jtulach@120: */
jtulach@120: E nextElement();
jtulach@120: }