public void InserBefore(DoublyLinkedKeyValue <K, V> old, DoublyLinkedKeyValue <K, V> novo) { if (old == first) { InserBeforeFirst(novo); } DoublyLinkedKeyValue <K, V> iterator = first; int i = 0; while (!iterator.Equals(old)) { iterator = iterator.Next; i++; } InsertAt(novo, i); }
public void InserAfter(DoublyLinkedKeyValue <K, V> old, DoublyLinkedKeyValue <K, V> novo) { if (old == last) { Add(novo); } DoublyLinkedKeyValue <K, V> iterator = first; int i = 0; while (!iterator.Equals(old)) { iterator = iterator.Next; i++; } InsertAt(novo, i + 1); }