Source of SeparateIterator.java


  1: import java.util.Iterator;
  2: import java.util.NoSuchElementException;
  3: /**
  4:    A class that represents an iterator for the ADT list.
  5:    
  6:    @author Frank M. Carrano
  7:    @author Timothy M. Henry
  8:    @version 4.0
  9: */
 10: public class SeparateIterator<T> implements Iterator<T>
 11: {
 12:    private ListInterface<T> list;
 13:    private int              nextPosition;  // Position of entry last returned by next()
 14:    private boolean          wasNextCalled; // Needed by remove
 15: 
 16:    public SeparateIterator(ListInterface<T> myList)
 17:    {
 18:       list = myList;
 19:       nextPosition = 0;
 20:       wasNextCalled = false;
 21:    } // end constructor
 22: 
 23: /* < Implementations of the methods hasNext, next, and remove go here. >
 24:      . . . */
 25: } // end SeparateIterator