public interface Deque<E>
Modifier and Type | Method and Description |
---|---|
void |
addFirst(E element)
Inserts an element to be the first in the deque.
|
void |
addLast(E element)
Inserts an element to be the last in the deque.
|
E |
getFirst()
Returns the first element; an exception is thrown if deque is empty.
|
E |
getLast()
Returns the last element; an exception is thrown if deque is empty.
|
boolean |
isEmpty()
Returns whether 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()
Returns the number of elements in the deque.
|
void addFirst(E element)
void addLast(E element)
E getFirst() throws EmptyDequeException
EmptyDequeException
E getLast() throws EmptyDequeException
EmptyDequeException
boolean isEmpty()
E removeFirst() throws EmptyDequeException
EmptyDequeException
E removeLast() throws EmptyDequeException
EmptyDequeException
int size()