| Constructor and Description |
|---|
NodeDeque()
Creates an empty deque.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFirst(E o)
Inserts an element to be the first in the deque.
|
void |
addLast(E o)
Inserts an element to be the last in the deque.
|
E |
getFirst()
Inspect the first element without modifying the deque.
|
E |
getLast()
Returns the last element; an exception is thrown if deque is empty.
|
boolean |
isEmpty()
This function returns true if and only if the deque is empty
|
E |
removeFirst()
Removes the first element; an exception is thrown if deque is empty.
|
E |
removeLast()
Removes the last element; an exception is thrown if deque is empty.
|
int |
size()
Return the size of the deque, that is the number of elements it has.
|
public void addFirst(E o)
Dequepublic void addLast(E o)
Dequepublic E getFirst() throws EmptyDequeException
getFirst in interface Deque<E>EmptyDequeExceptionpublic E getLast() throws EmptyDequeException
DequegetLast in interface Deque<E>EmptyDequeExceptionpublic boolean isEmpty()
public E removeFirst() throws EmptyDequeException
DequeremoveFirst in interface Deque<E>EmptyDequeExceptionpublic E removeLast() throws EmptyDequeException
DequeremoveLast in interface Deque<E>EmptyDequeException