Exemple #1
0
        public void ForEach(ForEachLambda cb)
        {
            LinkedNode <T> temp = head;

            do
            {
                cb(temp);
                temp = temp.nextNode;
            } while (temp != head);
        }
Exemple #2
0
        public IEnumerator <T> GetEnumerator()
        {
            LinkedNode <T> temp = head;

            do
            {
                yield return(temp.data);

                temp = temp.nextNode;
            } while (temp != head);
        }
Exemple #3
0
        public void Append(T data)
        {
            LinkedNode <T> node = new LinkedNode <T>(data);

            if (head == null)
            {
                head              = node;
                head.nextNode     = node;
                head.previousNode = node;
            }
            else
            {
                node.previousNode          = head.previousNode;
                node.nextNode              = head;
                head.previousNode.nextNode = node;
                head.previousNode          = node;
            }
        }