예제 #1
0
 private static void ResultIterator(DListIterator itr)
 {
     for (itr.Start(); itr.Valid(); itr.Forth())
     {
         Console.WriteLine(itr.Item());
     }
     itr.Start();
 }
예제 #2
0
        public void Remove(DListIterator p_iterator, DListNode node)
        {
            if (p_iterator.m_list != this)
            {
                return;
            }

            if (p_iterator.m_node == null)
            {
                return;
            }

            if (p_iterator.m_node == m_head)
            {
                p_iterator.Forth();
                RemoveHead();
            }
            else
            {
                while (node.m_next != p_iterator.m_node)
                {
                    node = node.m_next;
                }

                p_iterator.Forth();

                if (node.m_next == m_tail)
                {
                    m_tail = node;
                }

                node.m_next = null;
                node.m_next = p_iterator.m_node;
            }
            m_count--;
        }