I am working on some code were I need to add a Node into a doubly-linked list. This is the code I have so far:
Node tempNext = cursor.getNext();
temp = new Node(item, null, cursor, tempNext);
tempNext.setPrev(temp);
Where cursor is the Node that is right before where the new added Node should go.
How do I set the other nodes to correctly maintain the state of the doubly-linked list?
Writing meaningful variable names will always help you, never use names like temp*: