public class LinkedDeque<E> extends Object implements Deque<E>
DoublyLinkedList| Constructor and Description |
|---|
LinkedDeque()
Creates an empty deque.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFirst(E e)
Inserts an element at the front of the deque.
|
void |
addLast(E e)
Inserts an element at the back of the deque.
|
E |
first()
Returns (but does not remove) the first element of the deque.
|
boolean |
isEmpty()
Tests whether the deque is empty.
|
E |
last()
Returns (but does not remove) the last element of the deque.
|
E |
removeFirst()
Removes and returns the first element of the deque.
|
E |
removeLast()
Removes and returns the last element of the deque.
|
int |
size()
Returns the number of elements in the deque.
|
String |
toString()
Produces a string representation of the contents of the deque.
|
public int size()
Dequepublic boolean isEmpty()
Dequepublic E first()
Dequepublic E last()
Dequepublic void addFirst(E e)
Dequepublic void addLast(E e)
Dequepublic E removeFirst()
DequeremoveFirst in interface Deque<E>public E removeLast()
DequeremoveLast in interface Deque<E>