Class prominence.util.Queue
All Packages Class Hierarchy This Package Previous Next Index
Class prominence.util.Queue
java.lang.Object
|
+----prominence.util.Queue
- public class Queue
- extends Object
A FIFO (first in, first out) data-structure; the opposite of a Stack.
Objects are added to the front of the Queue and removed from the back.
This implementation blocks the caller who attempts to remove an object from
an empty queue until the queue is non-empty again.
-
queue
- A Vector of the queue elements.
-
Queue()
- Creates a new, empty Queue.
-
add(Object)
- Adds an item to the front of the queue, wakes a caller who is waiting for
the queue to become non-empty.
-
isEmpty()
- Returns whether the queue is empty.
-
remove()
- Attempts to remove an object from the queue; blocks if there are no objects
in the queue.
queue
protected Vector queue
- A Vector of the queue elements.
Queue
public Queue()
- Creates a new, empty Queue.
remove
public Object remove()
- Attempts to remove an object from the queue; blocks if there are no objects
in the queue. This call will therefore always return an object.
- Returns:
- s The least-recently-added object from the queue
add
public void add(Object item)
- Adds an item to the front of the queue, wakes a caller who is waiting for
the queue to become non-empty.
- Parameters:
- item - The object to be added
isEmpty
public boolean isEmpty()
- Returns whether the queue is empty.
- Returns:
- s Whether the queue is empty
All Packages Class Hierarchy This Package Previous Next Index