emul/mini/src/main/java/java/util/Enumeration.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 23 Jan 2013 20:39:23 +0100
branchemul
changeset 554 05224402145d
parent 120 emul/src/main/java/java/util/Enumeration.java@d739cdce3891
permissions -rw-r--r--
First attempt to separate 'mini' profile from the rest of JDK APIs
jtulach@120
     1
/*
jtulach@120
     2
 * Copyright (c) 1994, 2005, Oracle and/or its affiliates. All rights reserved.
jtulach@120
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jtulach@120
     4
 *
jtulach@120
     5
 * This code is free software; you can redistribute it and/or modify it
jtulach@120
     6
 * under the terms of the GNU General Public License version 2 only, as
jtulach@120
     7
 * published by the Free Software Foundation.  Oracle designates this
jtulach@120
     8
 * particular file as subject to the "Classpath" exception as provided
jtulach@120
     9
 * by Oracle in the LICENSE file that accompanied this code.
jtulach@120
    10
 *
jtulach@120
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
jtulach@120
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jtulach@120
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
jtulach@120
    14
 * version 2 for more details (a copy is included in the LICENSE file that
jtulach@120
    15
 * accompanied this code).
jtulach@120
    16
 *
jtulach@120
    17
 * You should have received a copy of the GNU General Public License version
jtulach@120
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
jtulach@120
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jtulach@120
    20
 *
jtulach@120
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jtulach@120
    22
 * or visit www.oracle.com if you need additional information or have any
jtulach@120
    23
 * questions.
jtulach@120
    24
 */
jtulach@120
    25
jtulach@120
    26
package java.util;
jtulach@120
    27
jtulach@120
    28
/**
jtulach@120
    29
 * An object that implements the Enumeration interface generates a
jtulach@120
    30
 * series of elements, one at a time. Successive calls to the
jtulach@120
    31
 * <code>nextElement</code> method return successive elements of the
jtulach@120
    32
 * series.
jtulach@120
    33
 * <p>
jtulach@120
    34
 * For example, to print all elements of a <tt>Vector&lt;E&gt;</tt> <i>v</i>:
jtulach@120
    35
 * <pre>
jtulach@120
    36
 *   for (Enumeration&lt;E&gt; e = v.elements(); e.hasMoreElements();)
jtulach@120
    37
 *       System.out.println(e.nextElement());</pre>
jtulach@120
    38
 * <p>
jtulach@120
    39
 * Methods are provided to enumerate through the elements of a
jtulach@120
    40
 * vector, the keys of a hashtable, and the values in a hashtable.
jtulach@120
    41
 * Enumerations are also used to specify the input streams to a
jtulach@120
    42
 * <code>SequenceInputStream</code>.
jtulach@120
    43
 * <p>
jtulach@120
    44
 * NOTE: The functionality of this interface is duplicated by the Iterator
jtulach@120
    45
 * interface.  In addition, Iterator adds an optional remove operation, and
jtulach@120
    46
 * has shorter method names.  New implementations should consider using
jtulach@120
    47
 * Iterator in preference to Enumeration.
jtulach@120
    48
 *
jtulach@120
    49
 * @see     java.util.Iterator
jtulach@120
    50
 * @see     java.io.SequenceInputStream
jtulach@120
    51
 * @see     java.util.Enumeration#nextElement()
jtulach@120
    52
 * @see     java.util.Hashtable
jtulach@120
    53
 * @see     java.util.Hashtable#elements()
jtulach@120
    54
 * @see     java.util.Hashtable#keys()
jtulach@120
    55
 * @see     java.util.Vector
jtulach@120
    56
 * @see     java.util.Vector#elements()
jtulach@120
    57
 *
jtulach@120
    58
 * @author  Lee Boynton
jtulach@120
    59
 * @since   JDK1.0
jtulach@120
    60
 */
jtulach@120
    61
public interface Enumeration<E> {
jtulach@120
    62
    /**
jtulach@120
    63
     * Tests if this enumeration contains more elements.
jtulach@120
    64
     *
jtulach@120
    65
     * @return  <code>true</code> if and only if this enumeration object
jtulach@120
    66
     *           contains at least one more element to provide;
jtulach@120
    67
     *          <code>false</code> otherwise.
jtulach@120
    68
     */
jtulach@120
    69
    boolean hasMoreElements();
jtulach@120
    70
jtulach@120
    71
    /**
jtulach@120
    72
     * Returns the next element of this enumeration if this enumeration
jtulach@120
    73
     * object has at least one more element to provide.
jtulach@120
    74
     *
jtulach@120
    75
     * @return     the next element of this enumeration.
jtulach@120
    76
     * @exception  NoSuchElementException  if no more elements exist.
jtulach@120
    77
     */
jtulach@120
    78
    E nextElement();
jtulach@120
    79
}