Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            IIntegerLinkedList myLinkedList = new IntegerLinkedList();

            myLinkedList.AddToFront(5);
            myLinkedList.AddToFront(4);
            myLinkedList.AddToFront(3);

            myLinkedList.AddToBack(6);
            myLinkedList.AddToBack(7);
            myLinkedList.AddToBack(8);

            myLinkedList.Display();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            IIntegerLinkedList myLinkedList = new IntegerLinkedList();

            myLinkedList.Display();
            myLinkedList.AddToFront(5);
            myLinkedList.AddToFront(4);
            myLinkedList.AddToFront(3);
            myLinkedList.AddToBack(6);
            myLinkedList.AddToBack(7);
            myLinkedList.AddToBack(8);
            myLinkedList.Display();

            //****************************************
            //Here is a generic linked list that tores strings
            IGenericLinkedList <string> myGenericLinkedList = new GenericLinkedList <String>();


            //Here is a generic linked list tat stores any class the implements the IComparable interface
            IGenericLinkedList <IComparable> myComparablelinkedList = new GenericLinkedList <IComparable>();

            //Let's use the string one
            myGenericLinkedList.AddToBack("Foo");
            myGenericLinkedList.AddToBack("bar");
            myGenericLinkedList.AddToBack("Dave");
            myGenericLinkedList.AddToBack("Barnes");

            myGenericLinkedList.AddToBack("Back 4");
            myGenericLinkedList.AddToBack("Back 3");
            myGenericLinkedList.AddToBack("Back 2");
            myGenericLinkedList.AddToBack("Back 1");

            myGenericLinkedList.Display();

            string frontGuy = myGenericLinkedList.RemoveFromFront();

            Console.WriteLine(frontGuy);

            myGenericLinkedList.Display();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            IIntegerLinkedList myLinkedList = new IntegerLinkedList();

            myLinkedList.AddToFront(5);
            myLinkedList.AddToFront(4);
            myLinkedList.AddToFront(3);

            myLinkedList.AddToBack(6);
            myLinkedList.AddToBack(7);
            myLinkedList.AddToBack(8);

            myLinkedList.Display();


            //Generic Linked List which stores strings
            IGenericLinkedList <string> myGenericLinkedList = new GenericLinkedList <string>();

            //Generic linked list whcih can store ANY class which implements IComparable
            IGenericLinkedList <IComparable> myComparableLinkedList = new GenericLinkedList <IComparable>();

            myGenericLinkedList.AddToFront("Dah");
            myGenericLinkedList.AddToFront("Ro");
            myGenericLinkedList.AddToFront("Fus");

            myGenericLinkedList.AddToBack("Wuld");
            myGenericLinkedList.AddToBack("Nah");
            myGenericLinkedList.AddToBack("Kest");

            myGenericLinkedList.Display();

            string frontGuy = myGenericLinkedList.RemoveFromFront();

            Console.WriteLine(frontGuy);

            myGenericLinkedList.Display();
        }