Re: Query regarding Enumeration
Friday, December 3, 2004 06:34 AM
That depends on the underlying data structure. It is a different thing between going over a list or a tree. Next point is that you should use the java.util.Iterator instead and the Collection API (since Java 1.2). Simply does the same but it´s the de facto standard. I dont know whether Enumeration is marked as deprecated... Enumeration.hasMoreElements()=Iterator.hasNext() and Enumerations.nextElement()=Iterator.next(). For Iterator you´ll find some implementation in java.util.AbstractList (a parent of Vector).