public class LongArrayQueue extends AbstractQueue<Long>
nullValue().
The LongArrayQueue.LongIterator is cached by default to avoid allocation unless directed to do so in the constructor.
Note: This class is not threadsafe.
| Modifier and Type | Class and Description |
|---|---|
class |
LongArrayQueue.LongIterator
Specialised
Iterator from which the value can be retrieved without boxing via LongArrayQueue.LongIterator.nextValue(). |
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_NULL_VALUE
Default representation of null for an element.
|
static int |
MIN_CAPACITY
Minimum capacity for the queue which must also be a power of 2.
|
| Constructor and Description |
|---|
LongArrayQueue()
Construct a new queue defaulting to
MIN_CAPACITY capacity, DEFAULT_NULL_VALUE
and cached iterators. |
LongArrayQueue(int initialCapacity,
long nullValue)
Construct a new queue default to cached iterators.
|
LongArrayQueue(int initialCapacity,
long nullValue,
boolean shouldAvoidAllocation)
Construct a new queue providing all the config options.
|
LongArrayQueue(long nullValue)
Construct a new queue defaulting to
MIN_CAPACITY capacity and cached iterators. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Long element) |
boolean |
addLong(long element)
Offer an element to the tail of the queue without boxing.
|
int |
capacity()
The current capacity for the collection.
|
void |
clear() |
Long |
element() |
long |
elementLong()
Peek at the element on the head of the queue without boxing.
|
void |
forEach(Consumer<? super Long> action) |
void |
forEachLong(LongConsumer action)
Iterate over the collection without boxing.
|
boolean |
isEmpty() |
LongArrayQueue.LongIterator |
iterator() |
long |
nullValue()
The value representing a null element.
|
boolean |
offer(Long element) |
boolean |
offerLong(long element)
Offer an element to the tail of the queue without boxing.
|
Long |
peek() |
long |
peekLong()
Peek at the element on the head of the queue without boxing.
|
Long |
poll() |
long |
pollLong()
Poll the element from the head of the queue without boxing.
|
Long |
remove() |
long |
removeLong()
Remove the element at the head of the queue without boxing.
|
int |
size() |
String |
toString() |
addAllcontains, containsAll, remove, removeAll, retainAll, toArray, toArrayclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, containsAll, equals, hashCode, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArraypublic static final long DEFAULT_NULL_VALUE
public static final int MIN_CAPACITY
public LongArrayQueue()
MIN_CAPACITY capacity, DEFAULT_NULL_VALUE
and cached iterators.public LongArrayQueue(long nullValue)
MIN_CAPACITY capacity and cached iterators.nullValue - cannot be stored in the queue and used as a sentinel.public LongArrayQueue(int initialCapacity,
long nullValue)
initialCapacity - for the queue which will be rounded up to the nearest power of 2.nullValue - which cannot be stored in the queue and used as a sentinel.public LongArrayQueue(int initialCapacity,
long nullValue,
boolean shouldAvoidAllocation)
initialCapacity - for the queue which will be rounded up to the nearest power of 2.nullValue - which cannot be stored in the queue and used as a sentinel.shouldAvoidAllocation - true to cache the iterator otherwise false to allocate a new iterator each time.public long nullValue()
public int capacity()
public int size()
size in interface Collection<Long>size in class AbstractCollection<Long>public boolean isEmpty()
isEmpty in interface Collection<Long>isEmpty in class AbstractCollection<Long>public void clear()
clear in interface Collection<Long>clear in class AbstractQueue<Long>public boolean offer(Long element)
public boolean offerLong(long element)
element - to be offered to the queue.public boolean add(Long element)
add in interface Collection<Long>add in interface Queue<Long>add in class AbstractQueue<Long>public boolean addLong(long element)
element - to be offered to the queue.public Long peek()
public long peekLong()
public Long poll()
public long pollLong()
nullValue.public Long remove()
public Long element()
public long elementLong()
NoSuchElementException - if the queue is empty.public long removeLong()
NoSuchElementException - if the queue is empty.public String toString()
toString in class AbstractCollection<Long>public void forEachLong(LongConsumer action)
action - to be taken for each element.public LongArrayQueue.LongIterator iterator()
iterator in interface Iterable<Long>iterator in interface Collection<Long>iterator in class AbstractCollection<Long>Copyright © 2014-2021 Real Logic Limited. All Rights Reserved.