public static MattyList <T> operator -(MattyList <T> b, MattyList <T> c)
        {
            MattyList <T> newList = new MattyList <T>();

            for (int i = 0; i < b.Count; i++)
            {
                b.MattyRemove(c[i]);
            }
            return(b);
        }
        public static MattyList <T> operator +(MattyList <T> b, MattyList <T> c)
        {
            MattyList <T> newList = new MattyList <T>();

            for (int i = 0; i < b.Count; i++)
            {
                newList.Add(b[i]);
            }
            for (int i = 0; i < c.Count; i++)
            {
                newList.Add(c[i]);
            }
            return(newList);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            MattyList <string> list1 = new MattyList <string> {
                "1", "2"
            };
            MattyList <string> list2 = new MattyList <string> {
                "1", "2", "3", "4"
            };

            list1.Zip(list2);
            foreach (string thing in list1)
            {
                Console.WriteLine(thing);
            }

            Console.ReadLine();
        }
        public void Zip(MattyList <T> userInput)
        {
            MattyList <T> tempArray = new MattyList <T>();
            int           x         = userInput.count;
            int           y         = Count;

            for (int i = 0; i < y || i < x; i++)
            {
                if (count == 0)
                {
                    tempArray.Add(userInput[i]);
                    userInput.count--;
                }
                else if (userInput.Count == 0)
                {
                    tempArray.Add(mattyArray[i]);
                    DecrementCount(1);
                }
                else
                {
                    tempArray.Add(userInput[i]);
                    tempArray.Add(mattyArray[i]);
                    userInput.count--;
                    DecrementCount(1);
                }
            }

            mattyArray = new T[tempArray.count];
            for (int i = 0; i < tempArray.Count; i++)
            {
                count = tempArray.Count;
                if (Count >= Capacity)
                {
                    capacity *= 2;
                }
                mattyArray[i] = tempArray[i];
            }
        }
 public void CountChecker(MattyList <T> list)
 {
 }