Exemple #1
0
        public static void Operations(ListyIterator <string> collection)
        {
            while (true)
            {
                var command        = Console.ReadLine();
                var elementToPrint = String.Empty;

                if (command == "Move")
                {
                    elementToPrint = collection.Move();
                }
                else if (command == "HasNext")
                {
                    elementToPrint = collection.HasNext();
                }
                else if (command == "Print")
                {
                    elementToPrint = collection.Print();
                }
                else if (command == "END")
                {
                    break;
                }

                Console.WriteLine(elementToPrint);
            }
        }
Exemple #2
0
        public static void Operations(ListyIterator <string> collection)
        {
            while (true)
            {
                var command        = Console.ReadLine();
                var elementToPrint = String.Empty;

                if (command == "Move")
                {
                    elementToPrint = collection.Move();
                }
                else if (command == "HasNext")
                {
                    elementToPrint = collection.HasNext();
                }
                else if (command == "Print")
                {
                    elementToPrint = collection.Print();
                }
                else if (command == "PrintAll")
                {
                    var toPrint = new StringBuilder();
                    foreach (var element in collection)
                    {
                        toPrint.Append(element + " ");
                    }

                    Console.Write(toPrint);
                }
                else if (command == "END")
                {
                    break;
                }

                Console.WriteLine(elementToPrint);
            }
        }