Пример #1
0
        /// <summary>
        /// Removes all values in the Skip List
        /// </summary>
        public virtual void Clear()
        {
            SkipListNode <T> currentNode = this.Head;

            while (currentNode != null)
            {
                SkipListNode <T> nextNode = currentNode.Next; //save reference to next node

                if (!currentNode.IsHeader() && !currentNode.IsFooter())
                {
                    this.Remove(currentNode);
                }

                currentNode = nextNode;
            }
        }
Пример #2
0
            public bool MoveNext()
            {
                if (current == null)
                {
                    current = this.skipList.Head.Next; //Head is header node, start after
                }
                else
                {
                    current = current.Next;
                }

                if (current != null && current.IsFooter())
                {
                    current = null; //end of list
                }
                return(current != null);
            }