public void InsertAfter(T target, T data) { var current = Head; while (current != null) { if (current.Data.Equals(target)) { var item = new DuplexItem <T>(data); current.Next = item.Next; item.Next = Tail; Tail.Previous = item.Previous; current.Next = item; Count++; Count++; return; } else { current = current.Next; } } }
public DuplexLinkedList(T data) { var item = new DuplexItem <T>(data); Head = item; Tail = item; Count = 1; }
public void Add(T data) { var item = new DuplexItem <T>(data); if (Count == 0) { Head = item; Tail = item; Count = 1; return; } Tail.Next = item; item.Previous = Tail; Tail = item; Count++; }