This interface defines the methods necessary to enumerate, or iterate, through a set of values, such as the set of values contained in a hashtable. This interface is superseded in Java 1.2 by the Iterator inteface. In Java 5.0 this interface has been made generic and defines the type variable E to represent the type of the objects being enumerated. An Enumeration is usually not instantiated directly, but instead is created by the object that is to have its values enumerated. A number of classes, such as Vector and Hashtable , have methods that return Enumeration objects. To use an Enumeration object, you use its two methods in a loop. hasMoreElements( ) returns TRue if there are more values to be enumerated and can determine whether a loop should continue. Within a loop, a call to nextElement( ) returns a value from the enumeration. An Enumeration makes no guarantees about the order in which the values are returned. The values in an Enumeration can be iterated through only once; there is no way to reset it to the beginning. public interface Enumeration<E> { // Public Instance Methods boolean hasMoreElements ( ); E nextElement ( ); } ImplementationsStringTokenizer Passed Tojava.io.SequenceInputStream.SequenceInputStream( ) , Collections.list( ) Returned ByToo many methods to list. |