/** * Specialized Iterator for MyListCollection. * * @author R. P. Futrelle * @version 21 June 2003 (started 21 June 2003) */ class MyListIterator implements MyIterator { ListCell current; MyListCollection _collection; MyListIterator(MyListCollection collection) { _collection = collection; current = _collection.top; } public boolean hasNext() { return current != null ; } // hasNext() public Object next() { if (current == null) return null; ListCell cell = current; current = cell.next; return cell.contents; } // next() } // MyListIterator