1: // @author Frank M. Carrano, Timothy M. Henry
2: // @version 5.0
3: public void remove()
4: {
5: if (wasNextCalled)
6: {
7: // nextPosition was incremented by the call to next(), so
8: // it is the position number of the entry to be removed
9: list.remove(nextPosition);
10: nextPosition--; // A subsequent call to next() must be
11: // unaffected by this removal
12: wasNextCalled = false; // Reset flag
13: }
14: else
15: throw new IllegalStateException("Illegal call to remove(); " +
16: "next() was not called.");
17: } // end remove