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