|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.pivot.collections.ArrayQueue<T>
public class ArrayQueue<T>
Implementation of the Queue interface that is backed by an
array.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.apache.pivot.collections.Queue |
|---|
Queue.QueueListenerList<T> |
| Constructor Summary | |
|---|---|
ArrayQueue()
|
|
ArrayQueue(Comparator<T> comparator)
|
|
ArrayQueue(int capacity)
|
|
| Method Summary | |
|---|---|
void |
clear()
Removes all elements from the collection. |
T |
dequeue()
Removes the item from the head of the queue and returns it. |
void |
enqueue(T item)
Enqueues an item. |
void |
ensureCapacity(int capacity)
|
Comparator<T> |
getComparator()
Returns the collection's sort order. |
int |
getLength()
Returns the length of the queue. |
ListenerList<QueueListener<T>> |
getQueueListeners()
Returns the queue listener list. |
boolean |
isEmpty()
Tests the emptiness of the queue. |
Iterator<T> |
iterator()
|
T |
peek()
Returns the item at the head of the queue without removing it from the queue. |
void |
setComparator(Comparator<T> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayQueue()
public ArrayQueue(Comparator<T> comparator)
public ArrayQueue(int capacity)
| Method Detail |
|---|
public void enqueue(T item)
Queue
enqueue in interface Queue<T>item - The item to add to the queue.public T dequeue()
Queueremove(getLength() - 1, 1);
dequeue in interface Queue<T>public T peek()
Queue
peek in interface Queue<T>public void clear()
Collection
clear in interface Collection<T>public boolean isEmpty()
Queue
isEmpty in interface Collection<T>isEmpty in interface Queue<T>public int getLength()
Queue
getLength in interface Queue<T>public void ensureCapacity(int capacity)
public Comparator<T> getComparator()
Collection
getComparator in interface Collection<T>Collection.setComparator(Comparator)public void setComparator(Comparator<T> comparator)
CollectionCalling this method more than once with the same comparator will re-sort the collection.
setComparator in interface Collection<T>comparator - The comparator used to order elements in the collection, or null if the
collection is unsorted.public Iterator<T> iterator()
iterator in interface Iterable<T>public ListenerList<QueueListener<T>> getQueueListeners()
Queue
getQueueListeners in interface Queue<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||