|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.elkoserver.foundation.run.Queue
public class Queue
A conventional fifo queue in which dequeued items are removed in the same
order they were enqueued. An untyped queue can hold any object (except
null). A queue can be created with a dynamic type, in which case, at no
extra overhead, enqueue will only enqueue objects of that type (or a
subtype, but not null). This check imposes no extra overhead, since Java
always makes us pay for a dynamic type check on array store anyway.
Queue is a thread-safe data structure, providing its own lock, and a
blocking dequeue() operation.
| Constructor Summary | |
|---|---|
Queue()
Makes a Queue that can hold any object. |
|
Queue(Class elementType)
Makes a Queue that can hold objects of the specified elementType. |
|
| Method Summary | |
|---|---|
Object |
dequeue()
Get the least-recently-added element off of the queue. |
void |
enqueue(Object newElement)
Add a new element to the queue. |
boolean |
hasMoreElements()
Check to see if the queue has more elements. |
Object |
nextElement()
Get the least-recently-added element off of the queue. |
Object |
optDequeue()
Get the least-recently-added element off of the queue, or null if the queue is currently empty. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Queue()
public Queue(Class elementType)
elementType - may not be a primitive (ie, scalar) type.| Method Detail |
|---|
public Object dequeue()
public void enqueue(Object newElement)
newElement - the object to be added to the end of the queue.
NullPointerException - thrown if newElement is null
ArrayStoreException - thrown if newElement does not conform
to the elementType specified in the Queue constructor.public boolean hasMoreElements()
hasMoreElements in interface Enumeration
public Object nextElement()
throws NoSuchElementException
nextElement in interface EnumerationNoSuchElementExceptionpublic Object optDequeue()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||