public static void InsertAfter <T>(DoubleLinkedList <T> list, DoubleLinkedNode <T> node, T newValue) { if (node == null) { return; } DoubleLinkedNode <T> newNode = new DoubleLinkedNode <T>(node, node.Next, newValue); node.Next = newNode; if (list.LastNode == node) { list.LastNode = newNode; } else { node.Next.Prev = newNode; } }
public DoubleLinkedNode(DoubleLinkedNode <T> prev, DoubleLinkedNode <T> next, T value) { Prev = prev; Next = next; Data = value; }