public void Concat(LinkListGen <T> tempList2) { LinkGen <T> temp = list; while (temp != null) { tempList2.AppendItem(temp.Data); temp = temp.Next; } list = tempList2.list; }
public void Copy(LinkListGen <T> tempList) { LinkGen <T> temp = list; while (temp != null) { tempList.AddItem(temp.Data); temp = temp.Next; } list = tempList.list; }
public void Sort() { LinkGen <T> temp = list; LinkListGen <T> tempList = new LinkListGen <T>(); while (temp != null) { tempList.InsertInOrder(temp.Data); temp = temp.Next; } list = tempList.list; }
public void RemoveItem(T item) { LinkGen <T> temp = list; LinkListGen <T> tempList = new LinkListGen <T>(); while (temp != null) { if (item.CompareTo(temp.Data) != 0) { tempList.AddItem(temp.Data); } temp = temp.Next; } list = tempList.list; }
/*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; }