E - the element typepublic class ListQueue<E> extends AbstractQueue<E>
| Modifier and Type | Field and Description |
|---|---|
protected List<E> |
list
List container
|
DEFAULT_MAXIMUM_SIZE, maximumSizeUNLIMITED_MAXIMUM_SIZE| Constructor and Description |
|---|
ListQueue()
Construct a new unconstrained ListQueue using a
LinkedList for a data-structure. |
ListQueue(int maxSize)
Construct a new constrained ListQueue using a
LinkedList for a data-structure. |
ListQueue(List<E> list)
Construct a new unconstrained ListQueue.
|
ListQueue(List<E> list,
int maxSize)
Construct a new constrained ListQueue.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
addLast(E obj)
Appends the given element to the end of this list.
|
E |
getBack()
Get the object at the back of the queue.
|
E |
getFront()
Get the object at the front of the queue.
|
Iterator<E> |
iterator()
Returns an iterator over the elements in this list in proper sequence.
|
protected E |
removeFirst()
Remove the first object in the queue.
|
Iterator<E> |
reverseIterator()
Returns an iterator over the elements in this list in reverse sequence.
|
int |
size()
Get the size of the queue.
|
String |
toString()
Return a String representation of this queue.
|
add, clear, getMaximumSize, isEmpty, isFull, remove, setMaximumSizeaddAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArraypublic ListQueue(List<E> list, int maxSize)
list - The list which will be used to store queued objects.maxSize - The maximum size of the queue.IllegalArgumentException - List is null.public ListQueue(int maxSize)
LinkedList for a data-structure.maxSize - The maximum size of the queue.public ListQueue(List<E> list)
list - The list which will be used to store queued objects.IllegalArgumentException - List is nullpublic ListQueue()
LinkedList for a data-structure.protected boolean addLast(E obj)
addLast in class AbstractQueue<E>obj - Object to append.protected E removeFirst()
removeFirst in class AbstractQueue<E>public int size()
size in interface Collection<E>size in class AbstractCollection<E>public Iterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in class AbstractCollection<E>public E getFront() throws EmptyCollectionException
EmptyCollectionException - The queue is empty.public E getBack() throws EmptyCollectionException
EmptyCollectionException - The queue is empty.public Iterator<E> reverseIterator()
public String toString()
toString in class AbstractCollection<E>Copyright © 2015 JBoss by Red Hat. All rights reserved.