public bool Contains(DoubleList data) { DoublyNode <DoubleList> current = head; while (current != null) { if (current.Data.Equals(data)) { return(true); } current = current.Next; } return(false); }
public void Add(DoubleList data) { var node = new DoublyNode <DoubleList>(data); if (head == null) { head = node; } else { tail.Next = node; node.Previous = tail; } tail = node; count++; }
public void AddFirst(DoubleList data) { var node = new DoublyNode <DoubleList>(data); DoublyNode <DoubleList> temp = head; node.Next = temp; head = node; if (count == 0) { tail = head; } else { temp.Previous = node; } count++; }
public void Clear() { head = null; tail = null; count = 0; }