private void SetHeadItem(T data)
 {
     Head          = new DuplexItem <T>(data);
     Head.Next     = Head;
     Head.Previous = Head;
     Count         = 1;
 }
Exemple #2
0
        public DuplexLinkedList(T data)
        {
            var item = new DuplexItem <T>(data);

            Head  = item;
            Tail  = item;
            Count = 1;
        }
        public void Add(T data)
        {
            if (Count == 0)
            {
                SetHeadItem(data);
                return;
            }
            var item = new DuplexItem <T>(data);

            item.Next          = Head;
            item.Previous      = Head.Previous;
            Head.Previous.Next = item;
            Head.Previous      = item;
            Count++;
        }
Exemple #4
0
        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++;
        }
 private void RemoveItem(DuplexItem <T> current)
 {
     current.Next.Previous = current.Previous;
     current.Previous.Next = current.Next;
     Count--;
 }