E - The generic parameter that specifies the type of elements in the DoubleEndedQueue.public interface DoubleEndedQueueInterface<E>
extends java.lang.Iterable<E>
This is the DoubleEndedQueueInterface for the Midterm Exam of CMP-338.
The DoubleEndedQueue ADT is a double-ended queue. Users are allowed to add and remove elements from both the front and the back of the DoubleEndedQueue.
| Modifier and Type | Method and Description |
|---|---|
void |
addBack(E element)
Adds the specified element to the
back of the DoubleEndedQueue. |
void |
addFront(E element)
Adds the specified element to the
front of the DoubleEndedQueue. |
boolean |
isEmpty()
This method is called to determine if the DoubleEndedQueue is empty.
|
E |
peekBack()
Retrieves, but does not remove element at the
back of the DoubleEndedQueue. |
E |
peekFront()
Retrieves, but does not remove element at the
front of the DoubleEndedQueue. |
void |
removeAll()
Removes all elements from the DoubleEndedQueue making it empty.
|
E |
removeBack()
Retrieves and removes the element at the
back of the DoubleEndedQueue. |
E |
removeFront()
Retrieves and removes the element at the
front of the DoubleEndedQueue. |
int |
size()
This method is called to obtain the count of elements in the list.
|
boolean isEmpty()
int size()
void addFront(E element) throws java.lang.NullPointerException
front of the DoubleEndedQueue. If the specified element is null
the method will throw a NullPointerException.element - The element to add.java.lang.NullPointerException - If the specified element being added is null.void addBack(E element) throws java.lang.NullPointerException
back of the DoubleEndedQueue. If the specified element is null
the method will throw a NullPointerException.element - The element to add.java.lang.NullPointerException - If the specified element being added is null.E removeFront()
front of the DoubleEndedQueue.null if the DoubleEndedQueue is empty.E removeBack()
back of the DoubleEndedQueue.null if the DoubleEndedQueue is empty.E peekFront()
front of the DoubleEndedQueue.null if the DoubleEndedQueue is empty.E peekBack()
back of the DoubleEndedQueue.null if the DoubleEndedQueue is empty.void removeAll()