|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--jdsl.simple.ref.MyDeque
This is the implementation of the Deque interface Dbmy means of a doubly- linked list. Note that this class uses class DLNode, which is the node that stores the previos and next nodes in the list, and a reference to its element.
| Constructor Summary | |
MyDeque()
|
|
| Method Summary | |
java.lang.Object |
first()
Inspect the first element without modifying the deque. |
void |
insertFirst(java.lang.Object o)
Add an element at the front of the sequence. |
void |
insertLast(java.lang.Object o)
Add an element at the back of the sequence. |
boolean |
isEmpty()
This function returns true if and only if the deque is empty |
java.lang.Object |
last()
Inspect the last element without modifying the deque. |
java.lang.Object |
removeFirst()
Delete the element at the front of the sequence. |
java.lang.Object |
removeLast()
Delete the element at the back of the sequence. |
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 MyDeque()
| Method Detail |
public int size()
public boolean isEmpty()
public java.lang.Object first()
throws DequeEmptyException
public java.lang.Object last()
throws DequeEmptyException
public void insertFirst(java.lang.Object o)
element - New element for the front of the dequepublic void insertLast(java.lang.Object o)
element - New element for the back of the deque
public java.lang.Object removeFirst()
throws DequeEmptyException
public java.lang.Object removeLast()
throws DequeEmptyException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||