|
net.datastructures - version 3.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for a deque (double-ended queue). A deque is a collection of linearly arranged elements that are accessed, inserted, and removed at the beginning or at the end.
EmptyDequeException
,
Queue
,
Stack
Method Summary | |
Object |
first()
Gets the first element (without modifying the deque). |
void |
insertFirst(Object element)
Insert an element at the beginning. |
void |
insertLast(Object element)
Insert an element at the end. |
boolean |
isEmpty()
Tests if this 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()
Gets the number of elements. |
Method Detail |
public Object first() throws EmptyDequeException
EmptyDequeException
- if the deque is emptypublic Object last() throws EmptyDequeException
EmptyDequeException
- if the deque is emptypublic boolean isEmpty()
true
if the deque is empty, false
otherwise.public int size()
public void insertFirst(Object element)
element
- new element to be inserted.public void insertLast(Object element)
element
- new element to be inserted.public Object removeFirst() throws EmptyDequeException
EmptyDequeException
- if the deque is emptypublic Object removeLast() throws EmptyDequeException
EmptyDequeException
- if the deque is empty
|
net.datastructures - version 3.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |