|
datastructures | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.datastructures.NodeDeque
Implementation of the Deque interface by means of a doubly linked list. This class uses class DLNode, which implements a node of the list.
| Field Summary | |
protected DLNode |
header
|
protected int |
size
|
protected DLNode |
trailer
|
| Constructor Summary | |
NodeDeque()
Creates an empty deque. |
|
| Method Summary | |
Object |
first()
Inspect the first element without modifying the deque. |
void |
insertFirst(Object o)
Insert an element at the beginning. |
void |
insertLast(Object o)
Insert an element at the end. |
boolean |
isEmpty()
This function returns true if and only if the deque is empty |
Object |
last()
Gets the last element (without modifying the deque). |
Object |
removeFirst()
Remove the element at the beginning. |
Object |
removeLast()
Remove the element at the end. |
int |
size()
Return the size of the deque, that is the number of elements it has. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected DLNode header
protected DLNode trailer
protected int size
| Constructor Detail |
public NodeDeque()
| Method Detail |
public int size()
size in interface Dequepublic boolean isEmpty()
isEmpty in interface Deque
public Object first()
throws EmptyDequeException
first in interface DequeEmptyDequeException - if the deque is empty
public Object last()
throws EmptyDequeException
Deque
last in interface DequeEmptyDequeException - if the deque is emptypublic void insertFirst(Object o)
Deque
insertFirst in interface Dequeo - new element to be inserted.public void insertLast(Object o)
Deque
insertLast in interface Dequeo - new element to be inserted.
public Object removeFirst()
throws EmptyDequeException
Deque
removeFirst in interface DequeEmptyDequeException - if the deque is empty
public Object removeLast()
throws EmptyDequeException
Deque
removeLast in interface DequeEmptyDequeException - if the deque is empty
|
datastructures | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||