|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsalvo.jesus.util.Queue
public class Queue
A Queue represents a first-in-first-out (FIFO) data structure. Unlike java.lang.Stack that simply extends java.util.Vector, this class does not extend java.util.Vector but delegates its methods to a java.util.Vector. Therefore, unlike java.util.Stack, the methods from java.util.Vector are not available.
Field Summary | |
---|---|
(package private) java.util.Vector |
delegate
|
Constructor Summary | |
---|---|
Queue()
Creates an empty queue |
Method Summary | |
---|---|
java.lang.Object |
get()
Gets and removes the item at the beginning of the queue |
boolean |
isEmpty()
Tests if the queue is empty |
boolean |
isQueued(java.lang.Object item)
Tests if the item is in the queue. |
void |
put(java.lang.Object item)
Puts an item at the end of the queue. |
java.lang.String |
toString()
Returns a String representation of the queue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
java.util.Vector delegate
Constructor Detail |
---|
public Queue()
Method Detail |
---|
public void put(java.lang.Object item)
item
- The item to be added at the end of the queuepublic java.lang.Object get() throws EmptyQueueException
EmptyQueueException
public boolean isEmpty()
public boolean isQueued(java.lang.Object item)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |