Пример #1
0
 public void InsertAfter(T node)
 {
     if (!(node is AbstractLinked <T> n))
     {
         return;
     }
     if (n._next != null || n._prev != null)
     {
         throw new ArgumentException("this item is already member of other linked list");
     }
     n._next = _next;
     n._prev = this;
     _next   = n;
 }
Пример #2
0
 public void Remove()
 {
     if (_next == null && _prev == null)
     {
         throw new ArgumentException("this item is not a member of a linked list");
     }
     if (_prev != null)
     {
         _prev._next = _next;
         _prev       = null;
     }
     if (_next != null)
     {
         _next._prev = _prev;
         _next       = null;
     }
 }