public class ConcurrentShortQueue extends ShortQueue implements ConcurrentCollection
ShortQueue.ShortQueueIterable, ShortQueue.ShortQueueIterator| Modifier and Type | Field and Description |
|---|---|
protected org.mini2Dx.lockprovider.ReadWriteLock |
lock |
head, size, tail, values| Constructor and Description |
|---|
ConcurrentShortQueue()
Creates a new Queue which can hold 16 values without needing to resize backing array.
|
ConcurrentShortQueue(int initialSize)
Creates a new Queue which can hold the specified number of values without needing to resize backing array.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFirst(short object)
Prepend given object to the head.
|
void |
addLast(short object)
Append given object to the tail.
|
void |
clear()
Removes all values from this queue.
|
void |
ensureCapacity(int additional)
Increases the size of the backing array to accommodate the specified number of additional items.
|
boolean |
equals(java.lang.Object object) |
short |
first()
Returns the first (head) item in the queue (without removing it).
|
short |
get(int index)
Retrieves the value in queue without removing it.
|
org.mini2Dx.lockprovider.ReadWriteLock |
getLock()
Returns the collection's
ReadWriteLock |
int |
hashCode() |
int |
indexOf(short value)
Returns the index of first occurrence of value in the queue, or -1 if no such value exists.
|
boolean |
isEmpty()
Returns true if the queue is empty.
|
java.util.Iterator<java.lang.Short> |
iterator()
Returns an iterator for the items in the queue.
|
short |
last()
Returns the last (tail) item in the queue (without removing it).
|
boolean |
notEmpty()
Returns true if the queue has one or more items.
|
short |
removeFirst()
Remove the first item from the queue.
|
short |
removeIndex(int index)
Removes and returns the item at the specified index.
|
short |
removeLast()
Remove the last item from the queue.
|
boolean |
removeValue(short value)
Removes the first instance of the specified value in the queue.
|
int |
size()
Returns the size in a thread-safe manner
|
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String separator) |
resizepublic ConcurrentShortQueue()
public ConcurrentShortQueue(int initialSize)
initialSize - public int size()
public void addLast(short object)
addLast in class ShortQueueobject - can be nullpublic void addFirst(short object)
addFirst in class ShortQueueobject - can be nulladdLast(short)public void ensureCapacity(int additional)
ensureCapacity in class ShortQueueadditional - public short removeFirst()
removeFirst in class ShortQueuejava.util.NoSuchElementException - when queue is emptypublic short removeLast()
removeLast in class ShortQueuejava.util.NoSuchElementException - when queue is emptyremoveFirst()public int indexOf(short value)
indexOf in class ShortQueuevalue - public boolean removeValue(short value)
removeValue in class ShortQueuevalue - public short removeIndex(int index)
removeIndex in class ShortQueueindex - public boolean notEmpty()
notEmpty in class ShortQueuepublic boolean isEmpty()
isEmpty in class ShortQueuepublic short first()
first in class ShortQueuejava.util.NoSuchElementException - when queue is emptyaddFirst(short),
removeFirst()public short last()
last in class ShortQueuejava.util.NoSuchElementException - when queue is emptyaddLast(short),
removeLast()public short get(int index)
first().get in class ShortQueueindex - java.lang.IndexOutOfBoundsException - when the index is negative or greater or equal than sizepublic void clear()
clear in class ShortQueuepublic java.util.Iterator<java.lang.Short> iterator()
iterator in class ShortQueuepublic int hashCode()
hashCode in class ShortQueuepublic boolean equals(java.lang.Object object)
equals in class ShortQueuepublic java.lang.String toString()
toString in class ShortQueuepublic java.lang.String toString(java.lang.String separator)
toString in class ShortQueuepublic org.mini2Dx.lockprovider.ReadWriteLock getLock()
ConcurrentCollectionReadWriteLockgetLock in interface ConcurrentCollectionReadWriteLock