public static customList <T> operator +(customList <T> firstList, customList <T> secondList) { T[] tempArray = new T[firstList.Capacity + secondList.Capacity]; customList <T> addedList = new customList <T>(); addedList.myArray = tempArray; for (int i = 0; i < firstList.Count; i++) { addedList.Add(firstList[i]); } for (int i = addedList.Count; i < firstList.Count + secondList.Count; i++) { addedList.Add(secondList[i - firstList.Count]); } return(addedList); }
public customList <T> Zip(customList <T> secondList) { T[] tempArray = new T[this.Capacity + secondList.Capacity]; customList <T> zippedList = new customList <T>(); zippedList.myArray = tempArray; if (this.Count > secondList.Count) { for (int i = 0; i < secondList.Count; i++) { zippedList.Add(this[i]); zippedList.Add(secondList[i]); } for (int i = secondList.Count; i < this.Count; i++) { zippedList.Add(this[i]); } } else if (this.Count < secondList.Count) { for (int i = 0; i < this.Count; i++) { zippedList.Add(this[i]); zippedList.Add(secondList[i]); } for (int i = this.Count; i < secondList.Count; i++) { zippedList.Add(secondList[i]); } } else { for (int i = 0; i < this.Count; i++) { zippedList.Add(this[i]); zippedList.Add(secondList[i]); } } return(zippedList); }
public static customList <T> operator -(customList <T> firstList, customList <T> secondList) { T[] tempArray = new T[firstList.Capacity]; customList <T> subtractedList = new customList <T>(); subtractedList.myArray = tempArray; for (int i = 0; i < firstList.Count; i++) { subtractedList.Add(firstList[i]); } for (int i = 0; i < secondList.Count; i++) { if (subtractedList[i].Equals(secondList[i])) { subtractedList.Remove(secondList[i]); } } return(subtractedList); }