package saker.util
EntryAccumulator implementation that can accumulate entries into a pre-allocated array with a fixed capacity.
Instances of this class is created for a given capacity. At most capacity() number of entries can be added to the accumulator. When the accumulator cannot store the added element, BufferOverflowException will be thrown.
This accumulator can not be used concurrently from multiple threads.
When varying, but large number of elements are to be accumulated, consider using PartitionedEntryAccumulatorArray as that can dynamically allocate the underlying array when necessary.
KThe key type.
VThe value type.
public | EntryAccumulatorArray( Creates a new instance for the given capacity. |
public void | Adds an element to the accumulator. |
public int | capacity() Gets the capacity of this accumulator. |
public Iterator< | iterator() Returns an iterator over elements of type T . |
public void | put( Adds an key-value entry pair to the accumulator. |
public int | size() Gets the current number of accumulated elements in this accumulator. |
Creates a new instance for the given capacity.
capacityThe capacity.
NegativeArraySizeExceptionIf the capacity is negative.
Adds an element to the accumulator.
NullPointerExceptionIf the entry is
null
.BufferOverflowExceptionIf no more space available for storing the entry.
Gets the capacity of this accumulator.
At most capacity() number of entries can be added to this instance.
The capacity.
Adds an key-value entry pair to the accumulator.
BufferOverflowExceptionIf no more space available for storing the entry.
Overridden from: ElementAccumulator
Gets the current number of accumulated elements in this accumulator.
The number of elements present.