Vector, Stack: elements()
Dictionary, Hashtable, Properties: elements(), keys()
import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.Vector; public class MainClass { public static void main(String args[]) throws Exception { Vector v = new Vector(); v.add("a"); v.add("b"); v.add("c"); Collection col = v; Enumeration e = Collections.enumeration(col); for (; e.hasMoreElements();) { Object o = e.nextElement(); System.out.println(o); } } }
a b c