public class ConcurrentFloatQueue extends FloatQueue implements ConcurrentCollection
FloatQueue.FloatQueueIterable, FloatQueue.FloatQueueIterator| Modifier and Type | Field and Description |
|---|---|
protected ReadWriteLock |
lock |
head, size, tail, values| Constructor and Description |
|---|
ConcurrentFloatQueue()
Creates a new Queue which can hold 16 values without needing to resize backing array.
|
ConcurrentFloatQueue(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(float object)
Prepend given object to the head.
|
void |
addLast(float 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) |
float |
first()
Returns the first (head) item in the queue (without removing it).
|
float |
get(int index)
Retrieves the value in queue without removing it.
|
ReadWriteLock |
getLock()
Returns the collection's
ReadWriteLock |
int |
hashCode() |
int |
indexOf(float 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.Float> |
iterator()
Returns an iterator for the items in the queue.
|
float |
last()
Returns the last (tail) item in the queue (without removing it).
|
boolean |
notEmpty()
Returns true if the queue has one or more items.
|
float |
removeFirst()
Remove the first item from the queue.
|
float |
removeIndex(int index)
Removes and returns the item at the specified index.
|
float |
removeLast()
Remove the last item from the queue.
|
boolean |
removeValue(float value)
Removes the first instance of the specified value in the queue.
|
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String separator) |
resizeprotected ReadWriteLock lock
public ConcurrentFloatQueue()
public ConcurrentFloatQueue(int initialSize)
initialSize - public void addLast(float object)
addLast in class FloatQueueobject - can be nullpublic void addFirst(float object)
addFirst in class FloatQueueobject - can be nulladdLast(float)public void ensureCapacity(int additional)
ensureCapacity in class FloatQueueadditional - public float removeFirst()
removeFirst in class FloatQueuejava.util.NoSuchElementException - when queue is emptypublic float removeLast()
removeLast in class FloatQueuejava.util.NoSuchElementException - when queue is emptyremoveFirst()public int indexOf(float value)
indexOf in class FloatQueuevalue - public boolean removeValue(float value)
removeValue in class FloatQueuevalue - public float removeIndex(int index)
removeIndex in class FloatQueueindex - public boolean notEmpty()
notEmpty in class FloatQueuepublic boolean isEmpty()
isEmpty in class FloatQueuepublic float first()
first in class FloatQueuejava.util.NoSuchElementException - when queue is emptyaddFirst(float),
removeFirst()public float last()
last in class FloatQueuejava.util.NoSuchElementException - when queue is emptyaddLast(float),
removeLast()public float get(int index)
first().get in class FloatQueueindex - java.lang.IndexOutOfBoundsException - when the index is negative or greater or equal than sizepublic void clear()
clear in class FloatQueuepublic java.util.Iterator<java.lang.Float> iterator()
iterator in class FloatQueuepublic int hashCode()
hashCode in class FloatQueuepublic boolean equals(java.lang.Object object)
equals in class FloatQueuepublic java.lang.String toString()
toString in class FloatQueuepublic java.lang.String toString(java.lang.String separator)
toString in class FloatQueuepublic ReadWriteLock getLock()
ConcurrentCollectionReadWriteLockgetLock in interface ConcurrentCollectionReadWriteLock