- #1
trouty323
- 24
- 0
Homework Statement
Basically, I am assigned to implement my own iterator using a Doubly Linked List. The methods, of course, are hasNext(), next(), and remove(). The one that is giving me the most grief is the remove() method.
Homework Equations
The Attempt at a Solution
The code that I have currently is:
Code:
public void remove() {
lastItemReturned = lastItemReturned.prev;
nextItem = lastItemReturned.next.next;
index--;
}
Now, this could actually be right and I may be messing up somewhere else in the code, but I have a feeling this is not the case. Does anybody know if this part of code is right?