1: // @author Frank M. Carrano, Timothy M. Henry
2: // @version 5.0
3: public void remove()
4: {
5: if (isRemoveOrSetLegal)
6: {
7: isRemoveOrSetLegal = false;
9: if (lastMove.equals(Move.NEXT))
10: {
11: // next() called, but neither add() nor remove() has been
12: // called since.
14: // Remove entry last returned by next().
16: // nextIndex is 1 more than the index of the entry
17: // returned by next()
18: ArrayListWithListIterator.this.remove(nextIndex - 1);
19: nextIndex--; // Move iterator back
20: }
21: else
22: {
23: // previous() called, but neither add() nor remove() has been
24: // called since
26: // Remove entry last returned by previous().
28: // nextIndex is the index of the entry returned by previous().
29: ArrayListWithListIterator.this.remove(nextIndex);
30: } // end if
31: }
32: else
33: throw new IllegalStateException("Illegal call to remove(); " +
34: "next() or previous() not called, OR " +
35: "add() or remove() called since then.");
36: } // end remove