Skip to content
Snippets Groups Projects
Commit 7435871f authored by Martin Schmollinger's avatar Martin Schmollinger
Browse files

prev of old head needs to refer to the new head

parent e51a59da
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,7 @@ public class DoubleLinkedList<E> implements List<E> { ...@@ -43,6 +43,7 @@ public class DoubleLinkedList<E> implements List<E> {
} }
if (index == 0) { if (index == 0) {
ListNode newHead = new ListNode(element, null, head); ListNode newHead = new ListNode(element, null, head);
head.prev=newHead;
head = newHead; head = newHead;
if (size()==0) last=newHead; if (size()==0) last=newHead;
size++; size++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment