The doubly-linked queue should have "enqueue", "dequeue" and "peek" capabilities on either end. The methods we chose allow for adding and removing elements in both directions.
- public void addFront(T x)
- Adds the element to the front of the deque
- public T removeFront()
- Removes the element at the front of the deque and returns the removed element
- public T peekFront()
- Returns the element at the front of the deque
- public void addEnd(T x)
- Adds the element to the end of the deque
- public T removeEnd()
- Removes the element at the end of the deque and returns the removed element
- public T peekEnd()
- Returns the element at the end of the deque
- public boolean isEmpty()
- Returns true if the first element is null
- public int size()
- Returns number of elements present
Our team choose doubly-linked Node-based architecture for Deque because Deque is a double ended queue. The instance variables nextNode and prevNode and their methods from the doubly-linked nodes would be useful in adding, removing, and peeking from the front or end of the queue.