problem in remove() in iterator.
posted 4 years ago
If you read the docs, you'll see that calling next() and previous() doesn't just return the next or previous element. It also changes the state of the iterator, moving it one forward or one back. If you don't call remove(), then you're just going forward, back, forward, back, ... forever, and never getting to the end of the list.