E - the element typepublic abstract class AbstractQueue<E> extends AbstractCollection<E> implements Queue<E>
addLast(Object) and removeFirst().| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAXIMUM_SIZE
Default maximum queue size
|
protected int |
maximumSize
Maximum queue size
|
UNLIMITED_MAXIMUM_SIZE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractQueue()
Initializes the AbstractQueue.
|
protected |
AbstractQueue(int maxSize)
Initializes the AbstractQueue.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E obj)
Append and object to the underling list.
|
protected abstract boolean |
addLast(E obj)
Appends the given element to the end of the queue
|
void |
clear()
Removes all of the elements from this queue
|
int |
getMaximumSize()
Get the maximum size of the queue.
|
boolean |
isEmpty()
Check if the queue is empty.
|
boolean |
isFull()
Check if the queue is full.
|
E |
remove()
Remove and return the first object in the queue.
|
protected abstract E |
removeFirst()
Remove the first object in the queue
|
void |
setMaximumSize(int size)
Set the maximum size of the queue
|
addAll, contains, containsAll, iterator, remove, removeAll, retainAll, size, toArray, toArray, toStringpublic static int DEFAULT_MAXIMUM_SIZE
protected int maximumSize
protected AbstractQueue()
protected AbstractQueue(int maxSize)
maxSize - Maximum queue size.IllegalArgumentException - Illegal size.public int getMaximumSize()
getMaximumSize in interface Queue<E>Queue.UNLIMITED_MAXIMUM_SIZE.public void setMaximumSize(int size)
setMaximumSize in interface Queue<E>size - New maximim queue size or Queue.UNLIMITED_MAXIMUM_SIZE.IllegalArgumentException - Illegal size.public boolean isFull()
public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface Queue<E>isEmpty in class AbstractCollection<E>public boolean add(E obj) throws FullCollectionException
add in interface Collection<E>add in interface Queue<E>add in class AbstractCollection<E>obj - Object to enqueue.FullCollectionException - The queue is full.public E remove() throws EmptyCollectionException
remove in interface Queue<E>EmptyCollectionException - The queue is empty.public void clear()
clear in interface Collection<E>clear in class AbstractCollection<E>protected abstract boolean addLast(E obj)
obj - Object to appendprotected abstract E removeFirst()
Copyright © 2015 JBoss by Red Hat. All rights reserved.