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)
Deque
public void addLast(E o)
Deque
public E getFirst() throws EmptyDequeException
getFirst
in interface Deque<E>
EmptyDequeException
public E getLast() throws EmptyDequeException
Deque
getLast
in interface Deque<E>
EmptyDequeException
public boolean isEmpty()
public E removeFirst() throws EmptyDequeException
Deque
removeFirst
in interface Deque<E>
EmptyDequeException
public E removeLast() throws EmptyDequeException
Deque
removeLast
in interface Deque<E>
EmptyDequeException