public final class SynchAdder<E> extends Object implements XAddingCollection<E>, Synchronized
XAddingCollection.Creator<E>| Constructor and Description |
|---|
SynchAdder(XAddingCollection<E> collection) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(E e) |
boolean |
add(E e)
Adds the passed element.
|
SynchAdder<E> |
addAll(E... elements) |
SynchAdder<E> |
addAll(E[] elements,
int offset,
int length) |
SynchAdder<E> |
addAll(XGettingCollection<? extends E> elements) |
long |
currentCapacity()
Returns the current amount of elements this instance can hold before a storage rebuild becomes necessary.
|
SynchAdder<E> |
ensureCapacity(long minimalCapacity) |
SynchAdder<E> |
ensureFreeCapacity(long minimalFreeCapacity)
Ensures that the next minimalFreeCapacity elements can be actually added in a fast way,
meaning for example no internal storage rebuild will be necessary.
|
boolean |
hasVolatileElements()
Tells if this collection contains volatile elements.
An element is volatile, if it can become no longer reachable by the collection without being removed from the collection. |
boolean |
isEmpty() |
boolean |
isFull() |
long |
maximumCapacity()
Returns the maximum amount of elements this carrier instance can contain.
The actual value may be depend on the configuration of the concrete instance or may depend only on the implementation of the carrier (meaning it is constant for all instances of the implementation, e.g. |
boolean |
nullAdd() |
boolean |
nullAllowed()
Defines if null-elements are allowed inside the collection or not.
|
long |
optimize()
Optimizes the internal storage of this collection and returns the storage size of the collection after the
process is complete.
|
long |
remainingCapacity() |
long |
size() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcollectorcurrentFreeCapacitypublic SynchAdder(XAddingCollection<E> collection)
public final boolean nullAdd()
nullAdd in interface XAddingCollection<E>public final boolean add(E e)
XAddingCollectionadd in interface XAddingCollection<E>e - to addtrue if element was added; false if not@SafeVarargs public final SynchAdder<E> addAll(E... elements)
addAll in interface XAddingCollection<E>public final SynchAdder<E> addAll(XGettingCollection<? extends E> elements)
addAll in interface XAddingCollection<E>public final SynchAdder<E> addAll(E[] elements, int offset, int length)
addAll in interface XAddingCollection<E>public final void accept(E e)
public final SynchAdder<E> ensureFreeCapacity(long minimalFreeCapacity)
CapacityExtendableensureFreeCapacity in interface CapacityExtendableminimalFreeCapacity - the capacity to ensurepublic final SynchAdder<E> ensureCapacity(long minimalCapacity)
ensureCapacity in interface CapacityExtendablepublic final long currentCapacity()
CapacityExtendable
For carrier implementations that don't have a concept of storage rebuilding (like linked list for example)
this method returns the same value as CapacityCarrying.maximumCapacity().
currentCapacity in interface CapacityExtendablepublic final long maximumCapacity()
CapacityCarryingInteger.MAX_VALUE)maximumCapacity in interface CapacityCarryingpublic final boolean isFull()
isFull in interface CapacityCarryingpublic final long remainingCapacity()
remainingCapacity in interface CapacityCarryingpublic final long optimize()
OptimizableCollectionoptimize in interface OptimizableCollectionpublic final boolean hasVolatileElements()
ExtendedCollectionWeakReference of SoftReference or implementations of collection entries
that remove the element contained in an entry by some means outside the collection.WeakReference instances that are added to a a simple (non-volatile) implementation of a
collection do not make the collection volatile, as the elements themselves (the reference instances) are still
strongly referenced.hasVolatileElements in interface ExtendedCollection<E>true if the collection contains volatile elements.public final boolean nullAllowed()
ExtendedCollectionnullAllowed in interface ExtendedCollection<E>true if null is allowed inside the collection; false if notpublic final boolean isEmpty()
throws UnsupportedOperationException
isEmpty in interface SizedUnsupportedOperationExceptionpublic final long size()
throws UnsupportedOperationException
size in interface SizedUnsupportedOperationExceptionCopyright © 2022 MicroStream Software. All rights reserved.