public Via(Kid k1, Kid k2) { var chain = new UCLinkedList <Kid>(); chain.PushFront(k2); chain.PushFront(k1); Chain = chain; }
public UCLinkedList <T> Concat(UCLinkedList <T> other) { foreach (var node in other) { this.AddLast(node); } return(this); }
public Via(UCLinkedList <Kid> chain) { if (chain.Count < 2) { throw new ArgumentException("A Chain has to be at least two elements long."); } this.Chain = chain; }
public UCLinkedList <T> Reverse() { var chain = new UCLinkedList <T>(); foreach (var node in this) { chain.PushFront(node); } return(chain); /* TODO: do this properly * ref var left = this.First; * ref var right = this.Last; * for (var i = 0; i <= this.Count / 2; i++) { * (left, right) = (right, left); * * } */ }