Esempio n. 1
0
        private static void Main()
        {
            var history  = new BrowseHistory <string>();
            var iterator = history.CreateIterator();

            history.Push("a");
            history.Push("b");
            history.Push("c");
            history.Pop();
            history.Push("d");

            while (iterator.HasNext())
            {
                var url = iterator.Current();
                Console.WriteLine(url);

                iterator.Next();
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var history = new BrowseHistory();

            history.Push("page 1");
            history.Push("page 2");
            history.Push("page 3");

            var iterator = history.CreateIterator();

            while (iterator.HasNext())
            {
                Console.WriteLine(iterator.Current());

                iterator.Next();
            }

            Console.ReadKey();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var browseHistory = new BrowseHistory <string>();

            browseHistory.Push("a");
            browseHistory.Push("b");
            browseHistory.Push("c");

            var browseHistoryIterator = browseHistory.CreateIterator();

            while (browseHistoryIterator.HasNext())
            {
                Console.WriteLine(browseHistoryIterator.Current());

                browseHistoryIterator.Next();
            }

            Console.WriteLine("--- Exercise ---");

            var productCollection = new ProductCollection();

            productCollection.Add(new Product(1, "Product 1"));
            productCollection.Add(new Product(2, "Product 2"));
            productCollection.Add(new Product(3, "Product 3"));

            var productIterator = productCollection.CreateIterator();

            while (productIterator.HasNext())
            {
                Console.WriteLine(productIterator.Current());

                productIterator.Next();
            }

            Console.ReadLine();
        }