public void Add(T item) { var newNode = new LooselyLinkedListNode <T>(item); last.Next = newNode; last = newNode; }
public static LooselyLinkedListNode <T> CreateDummyFor(LooselyLinkedListNode <T> node) { var dummy = new LooselyLinkedListNode <T>(default(T)); dummy.Next = node; return(dummy); }
public void CutAfter(LooselyLinkedListNode <T> node) { if (node == null) { throw new ArgumentNullException("node"); } node.Next = null; last = node; }
public void AddAfter(LooselyLinkedListNode <T> node, LooselyLinkedListNode <T> newNode) { if (newNode == null) { throw new ArgumentNullException("newNode"); } if (node == null) { throw new ArgumentNullException("node"); } var lastNew = newNode; while (lastNew.Next != null) { lastNew = lastNew.Next; } if (node == last) { last = lastNew; } lastNew.Next = node.Next; node.Next = newNode; }
public void Add(LooselyLinkedListNode <T> newNode) { AddAfter(last, newNode); }
public void Reset() { current = first; }
public bool MoveNext() { current = current.Next; return(current != null); }
public Enumerator(LooselyLinkedListNode <T> first) { this.current = first; this.first = first; }
public LooselyLinkedList() { first = new LooselyLinkedListNode <T>(default(T)); last = first; }
public void Clear() { first.Next = null; last = first; }
public void AddFirst(LooselyLinkedListNode <T> newNode) { AddAfter(first, newNode); }
public void AddAfter(LooselyLinkedListNode <T> node, T value) { AddAfter(node, new LooselyLinkedListNode <T>(value)); }