E - The type of element managed by this collection.public class Queue<E> extends java.lang.Object implements FIFO<E>
| Constructor and Description |
|---|
Queue()
This constructor creates a new queue of unlimited capacity.
|
Queue(int capacity)
This constructor creates a new queue with the specified capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTailElement(E element)
This method adds a new element to the tail of the queue.
|
Iterator<E> |
createDefaultIterator()
This method creates a new default iterator for the collection.
|
E |
getHeadElement()
This method returns a reference to the element at the head of the queue
without removing the element from the queue.
|
int |
getNumberOfElements() |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
void |
removeAllElements()
This method removes all elements from the collection.
|
E |
removeHeadElement()
This method removes the next element from the head of the queue.
|
void |
toArray(E[] array) |
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String indentation) |
public Queue()
public Queue(int capacity)
capacity - The maximum number of elements that can be in the queue
at one time.public final boolean isEmpty()
isEmpty in interface Sequential<E>public final int getNumberOfElements()
getNumberOfElements in interface Sequential<E>public final Iterator<E> createDefaultIterator()
IteratablecreateDefaultIterator in interface Iteratable<E>public final void toArray(E[] array)
toArray in interface Sequential<E>public final void addTailElement(E element) throws java.lang.InterruptedException
FIFOaddTailElement in interface FIFO<E>element - The new element to be added.java.lang.InterruptedException - The thread that was waiting to add an element
was interrupted.public final E removeHeadElement() throws java.lang.InterruptedException
FIFOremoveHeadElement in interface FIFO<E>java.lang.InterruptedException - The thread that was waiting to remove an element
was interrupted.public final void removeAllElements()
IteratableremoveAllElements in interface Iteratable<E>public final E getHeadElement()
FIFOgetHeadElement in interface FIFO<E>public final Iterator<E> iterator()
iterator in interface Sequential<E>iterator in interface java.lang.Iterable<E>public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2014 Crater Dog Technologies(TM). All rights reserved.