Enumeration.java 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* Enumeration.java -- Interface for enumerating lists of objects
  2. Copyright (C) 1998, 1999, 2001, 2004, 2005
  3. Free Software Foundation, Inc.
  4. This file is part of GNU Classpath.
  5. GNU Classpath is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9. GNU Classpath is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GNU Classpath; see the file COPYING. If not, write to the
  15. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA.
  17. Linking this library statically or dynamically with other modules is
  18. making a combined work based on this library. Thus, the terms and
  19. conditions of the GNU General Public License cover the whole
  20. combination.
  21. As a special exception, the copyright holders of this library give you
  22. permission to link this library with independent modules to produce an
  23. executable, regardless of the license terms of these independent
  24. modules, and to copy and distribute the resulting executable under
  25. terms of your choice, provided that you also meet, for each linked
  26. independent module, the terms and conditions of the license of that
  27. module. An independent module is a module which is not derived from
  28. or based on this library. If you modify this library, you may extend
  29. this exception to your version of the library, but you are not
  30. obligated to do so. If you do not wish to do so, delete this
  31. exception statement from your version. */
  32. package java.util;
  33. /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
  34. * "The Java Language Specification", ISBN 0-201-63451-1.
  35. * Status: Believed complete and correct
  36. */
  37. /**
  38. * Interface for lists of objects that can be returned in sequence. Successive
  39. * objects are obtained by the nextElement method.
  40. * <p>
  41. * As of Java 1.2, the Iterator interface provides the same functionality, but
  42. * with shorter method names and a new optional method to remove items from the
  43. * list. If writing for 1.2, consider using Iterator instead. Enumerations over
  44. * the new collections classes, for use with legacy APIs that require them, can
  45. * be obtained by the enumeration method in class Collections.
  46. *
  47. * @author Warren Levy (warrenl@cygnus.com)
  48. * @author Eric Blake (ebb9@email.byu.edu)
  49. * @see Iterator
  50. * @see Hashtable
  51. * @see Vector
  52. * @since 1.0
  53. * @status updated to 1.4
  54. */
  55. public interface Enumeration<E>
  56. {
  57. /**
  58. * Tests whether there are elements remaining in the enumeration.
  59. *
  60. * @return true if there is at least one more element in the enumeration,
  61. * that is, if the next call to nextElement will not throw a
  62. * NoSuchElementException.
  63. */
  64. boolean hasMoreElements();
  65. /**
  66. * Obtain the next element in the enumeration.
  67. *
  68. * @return the next element in the enumeration
  69. * @throws NoSuchElementException if there are no more elements
  70. */
  71. E nextElement();
  72. }