home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / Enumeration.java < prev    next >
Text File  |  1997-05-20  |  3KB  |  74 lines

  1. /*
  2.  * @(#)Enumeration.java    1.11 97/01/28
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. package java.util;
  24.  
  25. /**
  26.  * An object that implements the Enumeration interface generates a 
  27.  * series of elements, one at a time. Successive calls to the 
  28.  * <code>nextElement</code> method return successive elements of the 
  29.  * series. 
  30.  * <p>
  31.  * For example, to print all elements of a vector <i>v</i>:
  32.  * <blockquote><pre>
  33.  *     for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
  34.  *         System.out.println(e.nextElement());<br>
  35.  *     }
  36.  * </pre></blockquote>
  37.  * <p>
  38.  * Methods are provided to enumerate through the elements of a 
  39.  * vector, the keys of a hashtable, and the values in a hashtable. 
  40.  * Enumerations are also used to specify the input streams to a 
  41.  * <code>SequenceInputStream</code>. 
  42.  *
  43.  * @see     java.io.SequenceInputStream
  44.  * @see     java.util.Enumeration#nextElement()
  45.  * @see     java.util.Hashtable
  46.  * @see     java.util.Hashtable#elements()
  47.  * @see     java.util.Hashtable#keys()
  48.  * @see     java.util.Vector
  49.  * @see     java.util.Vector#elements()
  50.  *
  51.  * @author  Lee Boynton
  52.  * @version 1.11, 01/28/97
  53.  * @since   JDK1.0
  54.  */
  55. public interface Enumeration {
  56.     /**
  57.      * Tests if this enumeration contains more elements.
  58.      *
  59.      * @return  <code>true</code> if this enumeration contains more elements;
  60.      *          <code>false</code> otherwise.
  61.      * @since   JDK1.0
  62.      */
  63.     boolean hasMoreElements();
  64.  
  65.     /**
  66.      * Returns the next element of this enumeration.
  67.      *
  68.      * @return     the next element of this enumeration. 
  69.      * @exception  NoSuchElementException  if no more elements exist.
  70.      * @since      JDK1.0
  71.      */
  72.     Object nextElement();
  73. }
  74.