Data Structures, Algorithms, & Applications in Java
Chapter 5, Exercise 23



The codes for the new methods are
// reset to start of list
public void reset()
   {nextIndex = 0;}

// @return false iff at front of list
public boolean hasPrevious()
   {return nextIndex > 0;}

/** @return previous element in list
  * @throws NoSuchElementException
  * when there is no previous element */
public Object previous()
{
   if (nextIndex > 0)
      return element[--nextIndex];
   else throw new NoSuchElementException("No previous element");
}



These codes and sample test data appear in the class dataStructures.ArrayLinearListWithNewIterator.