Fix error in insertAfter method

This commit is contained in:
Manuel Thalmann 2022-09-28 10:21:44 +02:00
parent 0aeb39d677
commit 882130f703

View file

@ -198,7 +198,7 @@ public class MyList extends AbstractList<Object> {
* The item to insert. * The item to insert.
*/ */
protected void insertAfter(IListNode node, Object item) { protected void insertAfter(IListNode node, Object item) {
IListNode newNode = new ListNode(item, node, node.getNextNode()); IListNode newNode = new ListNode(item, node.getNextNode(), node);
node.setNextNode(newNode); node.setNextNode(newNode);
newNode.getNextNode().setPreviousNode(newNode); newNode.getNextNode().setPreviousNode(newNode);
} }