Class AbstractExtendedCollection<E>
- java.lang.Object
-
- one.microstream.collections.AbstractExtendedCollection<E>
-
- Type Parameters:
E
-
- All Implemented Interfaces:
ExtendedCollection<E>
- Direct Known Subclasses:
AbstractArrayCollection
,AbstractChainCollection
public abstract class AbstractExtendedCollection<E> extends Object implements ExtendedCollection<E>
This class is an implementation-internal for optional performance optimisation.It is the base class for every extended collection, even if the extending class does not implement
XAddingCollection
. Subclasses of this class that do not implementXAddingCollection
will throw anUnsupportedOperationException
in the adding methods defined in this class.
All code using the optimisation methods in here has to ensure that it can only be legally called for implementations ofXAddingCollection
, for example by usingXAddingCollection
as the concrete parameter type.Note that this technique of using
UnsupportedOperationException
is explicitly not comparable to the JDK's approach like inCollections.unmodifiableCollection(java.util.Collection)
where a general pupose type (java.util.Collection) is implemented intentionally broken to achieve a certain reduced behavior, while the technique described here is a cleanly encapsuled implementation detail used in combination with proper typing.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface one.microstream.collections.interfaces.ExtendedCollection
ExtendedCollection.Creator<E,C extends ExtendedCollection<E>>
-
-
Constructor Summary
Constructors Constructor Description AbstractExtendedCollection()
-
Method Summary
Modifier and Type Method Description static void
ensureFreeArrayCapacity(int size)
static void
validateIndex(long bound, long index)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface one.microstream.collections.interfaces.ExtendedCollection
hasVolatileElements, nullAllowed
-
-
-
-
Method Detail
-
validateIndex
public static void validateIndex(long bound, long index) throws IndexBoundsException
- Throws:
IndexBoundsException
-
ensureFreeArrayCapacity
public static void ensureFreeArrayCapacity(int size)
-
-