E - type of contained elementspublic abstract class AbstractExtendedCollection<E> extends Object implements ExtendedCollection<E>
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 implement XAddingCollection will throw an
UnsupportedOperationException 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
of XAddingCollection, for example by using XAddingCollection as the concrete parameter type.
Note that this technique of using UnsupportedOperationException is explicitly not comparable to the
JDK's approach like in Collections.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.
ExtendedCollection.Creator<E,C extends ExtendedCollection<E>>| Constructor and Description |
|---|
AbstractExtendedCollection() |
| Modifier and Type | Method and Description |
|---|---|
static void |
ensureFreeArrayCapacity(int size) |
protected abstract int |
internalCountingAddAll(E[] elements) |
protected abstract int |
internalCountingAddAll(E[] elements,
int offset,
int length) |
protected abstract int |
internalCountingAddAll(XGettingCollection<? extends E> elements) |
protected abstract int |
internalCountingPutAll(E[] elements) |
protected abstract int |
internalCountingPutAll(E[] elements,
int offset,
int length) |
protected abstract int |
internalCountingPutAll(XGettingCollection<? extends E> elements) |
static void |
validateIndex(long bound,
long index) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasVolatileElements, nullAllowedpublic static void validateIndex(long bound,
long index)
throws IndexBoundsException
IndexBoundsExceptionpublic static void ensureFreeArrayCapacity(int size)
protected abstract int internalCountingAddAll(E[] elements) throws UnsupportedOperationException
UnsupportedOperationExceptionprotected abstract int internalCountingAddAll(E[] elements, int offset, int length) throws UnsupportedOperationException
UnsupportedOperationExceptionprotected abstract int internalCountingAddAll(XGettingCollection<? extends E> elements) throws UnsupportedOperationException
UnsupportedOperationExceptionprotected abstract int internalCountingPutAll(E[] elements) throws UnsupportedOperationException
UnsupportedOperationExceptionprotected abstract int internalCountingPutAll(E[] elements, int offset, int length) throws UnsupportedOperationException
UnsupportedOperationExceptionprotected abstract int internalCountingPutAll(XGettingCollection<? extends E> elements) throws UnsupportedOperationException
UnsupportedOperationExceptionCopyright © 2022 MicroStream Software. All rights reserved.