/*public void InsertInOrder(T item) * { * bool added = false; * LinkGen<T> temp = list; * LinkListGen<T> tempList = new LinkListGen<T>(); * while (temp != null) * { * if ((temp.Data.CompareTo(item) >= 0) && (added == false)) * { * tempList.AddItem(item); * added = true; * } * tempList.AddItem(temp.Data); * temp = temp.Next; * } * list = tempList.list; * }*/ public void InsertInOrder(T item) { LinkGen <T> temp = list; LinkListGen <T> tempList = new LinkListGen <T>(); while ((temp != null) && (temp.Data.CompareTo(item) < 0)) { tempList.AppendItem(temp.Data); temp = temp.Next; } tempList.AppendItem(item); while (temp != null) { tempList.AppendItem(temp.Data); temp = temp.Next; } list = tempList.list; }
public void Concat(LinkListGen <T> tempList2) { LinkGen <T> temp = list; while (temp != null) { tempList2.AppendItem(temp.Data); temp = temp.Next; } list = tempList2.list; }