Пример #1
0
        static void QueueLinkedList()
        {
            QueueLinkedList queue = new QueueLinkedList();

            queue.Enqueue(1);
            queue.Enqueue(2);
            queue.Enqueue(3);
            queue.Enqueue(4);
            queue.Enqueue(5);
            queue.Enqueue(6);
            queue.Enqueue(7);

            foreach (int val in queue.GetEnumerator())
            {
                Console.WriteLine(val);
            }


            Console.WriteLine("Peek");
            Console.WriteLine(queue.Peek());
            Console.WriteLine(queue.Peek());

            Console.WriteLine("Pop");
            Console.WriteLine(queue.Dequeue());
            Console.WriteLine(queue.Dequeue());
            Console.WriteLine(queue.Dequeue());
            Console.WriteLine(queue.Dequeue());

            Console.WriteLine("Remaining");
            foreach (int val in queue.GetEnumerator())
            {
                Console.WriteLine(val);
            }

            Console.Read();
        }
Пример #2
0
 public void Enqueue()
 {
     _queue.Enqueue(3);
     _queue.Enqueue(4);
     Assert.IsTrue(_queue.Peek().Value == 3);
 }