|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjgroup.util.Queue
public final class Queue
The Queue class implements a queue with last-in,
first-out semantics. The queue is implemented as a linked list of
buckets, each of them contains a fixed number of objects. Appended
objects are inserted in the last bucket (if full, a new bucket is
allocated), while removed object are extracted from the first
bucket.
| Constructor Summary | |
|---|---|
Queue()
Allocates a queue with default bucket size. |
|
Queue(int bucketSize)
Allocates a queue with bucket size equal to bucketSize. |
|
| Method Summary | |
|---|---|
void |
add(Queue addend)
Add the elements of the addend queue at the end of this queue. |
void |
clear()
Removes all the elements from the queue. |
java.lang.Object |
getFirst()
Returns the first element of the queue; null if the queue is empty. |
void |
insert(java.lang.Object object)
Append object to the end of the queue. |
boolean |
isEmpty()
Returns true if the queue is empty. |
java.util.Iterator |
iterator()
Returns an iterator over the queue content. |
java.lang.Object |
removeFirst()
Removes the first element of the queue. |
int |
size()
Returns the size of the queue. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Queue(int bucketSize)
bucketSize.
bucketSize - The size of internal buckets.public Queue()
| Method Detail |
|---|
public void insert(java.lang.Object object)
object to the end of the queue.
object - The object to be inserted.public int size()
public boolean isEmpty()
public java.lang.Object getFirst()
public java.lang.Object removeFirst()
public void add(Queue addend)
addend - The queue to be added to the end of this queue.public void clear()
public java.util.Iterator iterator()
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 | |||||||||