I have a doubly linked list I need to remove current from. I've been staring for hours; I cant seem to remove the element & reestablish the links; any help would be great.
I hope I did the 'tags' right?
Code:public void removeCurrent() { if (isCurrent() == false) throw new IllegalStateException ("removeCurrent: isCurrent() is null"); else if ((isCurrent() == true) && (cursor.getNextNode() == null)) { tail = cursor; cursor = null; } else { cursor.getPrevNode().setNextNode(getNextNode()); //error here? don't know if this is //correct either manyNodes--; } } public DoubleNode getPrevNode(){ //these two things are in my other file return prev; } public void setPrevNode(DoubleNode dn){ prev = dn; }




Reply With Quote