@Override
		public void remove() {
			if (lastReturnedNode == null) {
				throw new IllegalStateException(
					"next has not been called or remove has already been called");
			}
			deleteEntry(lastReturnedNode);
			if (nextNode != null) {
				previousNode = forward ? nextNode.getPredecessor() : nextNode.getSuccessor();
			}
			else {
				previousNode = forward ? getLast() : getFirst();
			}
			lastReturnedNode = null;

			// Update the iterator modCount to match the modCount of the main class, since deletes
			// made via the iterator should not cause a concurrent modification exception.
			this.expectedModCount = modCount;
		}
Swap the linkages of two nodes in a tree.
Ghidra/Framework/Generic/src/main/java/ghidra/util/datastruct/RedBlackTree.java