import java.util.*; class DataStructure implements Enumeration { String[] stuff = {"Alice", "Bob", "Carol", "Dave", "Ella", }; int index = 0; public boolean hasMoreElements () { if (index < stuff.length) { return true; } else { return false; } } public Object nextElement () { String s = stuff[index]; index ++; return s; } public Enumeration getEnumeration () { index = 0; return this; } } public class DataStructureWithEnumeration { public static void main (String[] argv) { DataStructure ds = new DataStructure(); Enumeration e = ds.getEnumeration(); while (e.hasMoreElements()) { String s = (String) e.nextElement(); System.out.println (s); } } }