public class Queue
extends java.lang.Object
| Constructor and Description |
|---|
Queue()
Constructs an empty queue.
|
Queue(java.util.Collection objects)
Constructs a queue containing the given collection of objects.
|
Queue(java.lang.Object object)
Constructs a queue containing the given object.
|
Queue(java.lang.Object[] objects)
Constructs a queue containing the given array of objects
such that the lowest index is the oldest in the queue.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
chop()
Removes and returns the newest object queued in this queue.
|
java.lang.Object |
dequeue()
Removes and returns the oldest object queued in this queue.
|
void |
enqueue(java.lang.Object object)
Enqueues the given object in this queue.
|
boolean |
isEmpty()
Returns true iff this queue is empty.
|
java.util.Iterator |
iterator()
Returns an iterator for this queue in "popping" order; i.e.,
from the oldest to the newest elelemnt.
|
java.lang.Object |
peek()
Returns the oldest object queued in this queue without removing it.
|
java.lang.Object |
pop()
Removes and returns the oldest object queued in this queue.
|
void |
push(java.lang.Object object)
Enqueues the given object into this queue.
|
Queue |
reverse()
Returns this queue after reversing it in situ.
|
void |
rush(java.lang.Object object)
Places the given object at the head of this queue.
|
int |
size()
Returns the current number of elements in this queue.
|
java.lang.String |
toString()
Returns a string representation of this queue.
|
public Queue()
public Queue(java.lang.Object object)
public Queue(java.lang.Object[] objects)
public Queue(java.util.Collection objects)
public final boolean isEmpty()
public final int size()
public final void enqueue(java.lang.Object object)
public final void push(java.lang.Object object)
public final void rush(java.lang.Object object)
public final java.lang.Object dequeue()
public final java.lang.Object pop()
public final java.lang.Object chop()
public final java.util.Iterator iterator()
public final java.lang.Object peek()
public final Queue reverse()
public java.lang.String toString()
>> newest ... oldest >>
toString in class java.lang.Object