Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            List list = new List();

            list.Add(1);
            list.Add(2);
            list.Add(3);

            IListIterator iterator = list.CreateIterator();

            while (iterator.MoveNext())
            {
                Console.WriteLine(iterator.Current);
            }

            ReverseList revList = new ReverseList();

            revList.Add(1);
            revList.Add(2);
            revList.Add(3);

            IListIterator revIterator = revList.CreateIterator();

            while (revIterator.MoveNext())
            {
                Console.WriteLine(revIterator.Current);
            }


            Console.Read();
        }
Ejemplo n.º 2
0
 public static int ReversedListCapacity(int[] data)
 {
     ReverseList<int> testList = new ReverseList<int>();
     foreach (var i in data)
     {
         testList.Add(i);
     }
     return testList.Capacity;
 }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            var list = new ReverseList<int>();
            
            list.Add(8);
      
            list.Add(4);
            list.Add(3);
            list.Add(2);
            list.Add(1);

           // Console.WriteLine(list[4]);
            list.Remove(4);

            foreach (var i in list)
            {
                Console.WriteLine(i);
            }
        }
Ejemplo n.º 4
0
        public static int ReversedListCapacity(int[] data)
        {
            ReverseList <int> testList = new ReverseList <int>();

            foreach (var i in data)
            {
                testList.Add(i);
            }
            return(testList.Capacity);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            ReverseList<string> test = new ReverseList<string>();

            test.Add("item");
            test.Add("item2");
            test.Add("item3");
            test.Add("item4");
            test.Add("item5");
            test.Add("item6");
            for (int i = 0; i < test.Count; i++)
            {
                Console.WriteLine(test[i]);
            }
            test.Remove(2);
            for (int i = 0; i < test.Count; i++)
            {
                Console.WriteLine(test[i]);
            }

            foreach (var item in test)
            {
                Console.WriteLine(item);
            }
        }
Ejemplo n.º 6
0
 public static void ReversedListAdd(int[] data)
 {
     ReverseList<int> testList = new ReverseList<int>();
     foreach (var i in data)
     {
         testList.Add(i);
     }
     Assert.AreEqual(data.Length, testList.Count);
     int count = testList.Count;
     for (int i = 0; i < count; i++)
     {
         Assert.AreEqual(data[count-1-i], testList[i]);
     }
 }
Ejemplo n.º 7
0
        public static void ReversedListRemove(int[] data, int[] indexToRemove)
        {
            ReverseList <int> testList = new ReverseList <int>();

            foreach (var i in data)
            {
                testList.Add(i);
            }
            foreach (var i in indexToRemove)
            {
                testList.Remove(i);
            }
            Assert.AreEqual(testList.Count, data.Length - indexToRemove.Length);
        }
Ejemplo n.º 8
0
        public static void ReversedListAdd(int[] data)
        {
            ReverseList <int> testList = new ReverseList <int>();

            foreach (var i in data)
            {
                testList.Add(i);
            }
            Assert.AreEqual(data.Length, testList.Count);
            int count = testList.Count;

            for (int i = 0; i < count; i++)
            {
                Assert.AreEqual(data[count - 1 - i], testList[i]);
            }
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            ReverseList<string> test = new ReverseList<string>();
            test.Add("blabla");
            test.Add("blabla2");
            test.Add("blabla3");
            test.Add("blabla4");
            test.Add("blabla5");
            test.Add("blabla6");
            for (int i = 0; i < test.Count; i++)
            {
                Console.WriteLine(test[i]);
            }
            test.Remove(2);
            for (int i = 0; i < test.Count; i++)
            {
                Console.WriteLine(test[i]);
            }

            foreach (var VARIABLE in test)
            {
                Console.WriteLine(VARIABLE);
            }
        }
Ejemplo n.º 10
0
 public static void ReversedListRemove(int[] data,int[] indexToRemove)
 {
     ReverseList<int> testList = new ReverseList<int>();
     foreach (var i in data)
     {
         testList.Add(i);
     }
     foreach (var i in indexToRemove)
     {
         testList.Remove(i);
     }
     Assert.AreEqual(testList.Count, data.Length - indexToRemove.Length);
 }