Java - Adding a Node in a doubly-linked list.

Posted by jacobnlsn on Stack Overflow See other posts from Stack Overflow or by jacobnlsn
Published on 2010-03-22T18:14:06Z Indexed on 2010/03/22 18:21 UTC
Read the original article Hit count: 257

Filed under:
|
|

Hi, 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);

cursor is the Node that is right before the new added Node should go.

© Stack Overflow or respective owner

Related posts about java

Related posts about linked-list