|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.datastructures.NodeDeque<E>
public class NodeDeque<E>
Implementation of the Deque interface by means of a doubly linked list. This class uses class DLNode, which implements a node of the list.
Constructor Summary | |
---|---|
NodeDeque()
Creates an empty deque. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NodeDeque()
Method Detail |
---|
public int size()
size
in interface Deque<E>
public boolean isEmpty()
isEmpty
in interface Deque<E>
public E getFirst() throws EmptyDequeException
getFirst
in interface Deque<E>
EmptyDequeException
public E getLast() throws EmptyDequeException
Deque
getLast
in interface Deque<E>
EmptyDequeException
public void addFirst(E o)
Deque
addFirst
in interface Deque<E>
public void addLast(E o)
Deque
addLast
in interface Deque<E>
public E removeFirst() throws EmptyDequeException
Deque
removeFirst
in interface Deque<E>
EmptyDequeException
public E removeLast() throws EmptyDequeException
Deque
removeLast
in interface Deque<E>
EmptyDequeException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |