Beispiel #1
0
        public void ForEach(Action <T> action, bool shouldStartFromHead = true)
        {
            ListNode currentNode = this.head;

            if (!shouldStartFromHead)
            {
                currentNode = this.tail;
            }

            while (currentNode != null)
            {
                action(currentNode.Value);

                if (!shouldStartFromHead)
                {
                    currentNode = currentNode.PreviousNode;
                }
                else
                {
                    currentNode = currentNode.NextNode;
                }
            }
        }
Beispiel #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DynamicList{T}" /> class.
 /// </summary>
 public DynamicList()
 {
     this.head  = null;
     this.tail  = null;
     this.Count = 0;
 }
Beispiel #3
0
 /// <summary>
 /// Clears the DynamicList.
 /// </summary>
 public void Clear()
 {
     this.head  = null;
     this.tail  = null;
     this.Count = 0;
 }
 public ListNode(T element, ListNode prevNode)
 {
     this.Element      = element;
     prevNode.NextNode = this;
 }