public T PopBack() { if (Empty) { throw new Exception("DEQUE empty."); } last.Previous.Next = null; DoublyLinkedElement <T> temp = last; last = last.Previous; return(temp.Valor); }
public T PopFront() { if (Empty) { throw new Exception("DEQUE empty."); } first.Next.Previous = null; DoublyLinkedElement <T> temp = last; first = first.Next; return(temp.Valor); }
public void PushFront(T valor) { if (valor == null) { throw new Exception("Invalid value: null"); } DoublyLinkedElement <T> element = new DoublyLinkedElement <T>(valor); if (Empty) { last = element; } else { first.Previous = element; element.Next = first; } first = element; }