Source of 13.28.java


  1: // @author Frank M. Carrano, Timothy M. Henry
  2: // @version 5.0
  3: public int nextIndex()
  4: {
  5:    int result;

  7:    if (hasNext())
  8:       result = nextIndex - 1;   // Change to zero-based numbering of iterator
  9:    else
 10:       result = numberOfEntries; // End-of-list flag

 12:    return result;
 13: } // end nextIndex

 15: // 15.28
 16: public int previousIndex()
 17: {
 18:    int result;

 20:    if (hasPrevious())
 21:       result = nextIndex - 2; // Change to zero-based numbering of iterator
 22:    else
 23:       result = -1;            // Beginning-of-list flag

 25:    return result;
 26: } // end previousIndex