package util.list;
import java.util.Enumeration;
import java.util.NoSuchElementException;
class ListEnumeration implements Enumeration {
private ListLink cursor = null;
public ListEnumeration(List aList) {
cursor = aList.getHead();
}
public boolean hasMoreElements() {
return cursor != null;
}
public Object nextElement() throws NoSuchElementException {
if (!hasMoreElements())
throw new NoSuchElementException();
Object info = cursor.getInfo();
cursor = cursor.getNext();
return info;
}
}