Package one.microstream.collections
Class SubListProcessor<E>
- java.lang.Object
-
- one.microstream.collections.SubListView<E>
-
- one.microstream.collections.SubListProcessor<E>
-
- All Implemented Interfaces:
Iterable<E>,CapacityCarrying,ConsolidatableCollection,ExtendedBag<E>,ExtendedCollection<E>,ExtendedList<E>,ExtendedSequence<E>,OptimizableCollection,ReleasingCollection<E>,Sized,Truncateable,Sortable<E>,XDecreasingList<E>,XDecreasingSequence<E>,XGettingBag<E>,XGettingCollection<E>,XGettingList<E>,XGettingSequence<E>,XIndexIterable<E>,XIterable<E>,XJoinable<E>,XOrderingSequence<E>,XProcessingBag<E>,XProcessingCollection<E>,XProcessingList<E>,XProcessingSequence<E>,XRemovingBag<E>,XRemovingCollection<E>,XRemovingList<E>,XRemovingSequence<E>,XReplacingBag<E>,XReplacingCollection<E>,XSettingList<E>,XSettingSequence<E>,XSortableSequence<E>,Processable<E>,Clearable,Copyable
public class SubListProcessor<E> extends SubListView<E> implements XDecreasingList<E>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface one.microstream.typing.Copyable
Copyable.Static
-
Nested classes/interfaces inherited from interface one.microstream.collections.interfaces.ExtendedCollection
ExtendedCollection.Creator<E,C extends ExtendedCollection<E>>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XDecreasingList
XDecreasingList.Creator<E>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XGettingCollection
XGettingCollection.Creator<E>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XGettingList
XGettingList.Factory<E>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XGettingSequence
XGettingSequence.Factory<E>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XIterable
XIterable.Executor<E>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XProcessingList
XProcessingList.Factory<E>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XProcessingSequence
XProcessingSequence.Factory<E>
-
Nested classes/interfaces inherited from interface one.microstream.collections.types.XReplacingBag
XReplacingBag.Factory<E>
-
-
Constructor Summary
Constructors Constructor Description SubListProcessor(XProcessingList<E> list, long fromIndex, long toIndex)
-
Method Summary
Modifier and Type Method Description voidclear()Clears all elements from the collection while leaving the capacity as it is.longconsolidate()Consolidates the internal storage of this collection by discarding all elements of the internal storage that have become obsolete or otherwise unneeded anymore.SubListProcessor<E>copy()Creates a true copy of this list which references th same elements in the same order as this list does at the time the method is called.Efetch()XDecreasingList<E>fill(long offset, long length, E element)<C extends Consumer<? super E>>
CmoveSelection(C target, long... indices)<C extends Consumer<? super E>>
CmoveTo(C target, Predicate<? super E> predicate)longnullRemove()one.microstream.collections.SubListProcessor.OldSubListProcessor<E>old()longoptimize()Optimizes internal memory usage by rebuilding the storage to only occupy as much memory as needed to store the currently contained elements in terms of the collection's current memory usage configuration (e.g.Epick()Epinch()Epop()<P extends Consumer<? super E>>
Pprocess(P procedure)SubListProcessor<E>range(long fromIndex, long toIndex)longremove(E element)longremoveAll(XGettingCollection<? extends E> samples)EremoveAt(long index)longremoveBy(Predicate<? super E> predicate)longremoveDuplicates()longremoveDuplicates(Equalator<? super E> equalator)booleanremoveOne(E element)SubListProcessor<E>removeRange(long startIndex, long length)longremoveSelection(long[] indices)longreplace(E element, E replacement)longreplace(Predicate<? super E> predicate, E substitute)longreplaceAll(XGettingCollection<? extends E> elements, E replacement)booleanreplaceOne(E element, E replacement)booleanreplaceOne(Predicate<? super E> predicate, E substitute)longretainAll(XGettingCollection<? extends E> samples)SubListProcessor<E>retainRange(long startIndex, long length)Eretrieve(E element)EretrieveBy(Predicate<? super E> predicate)XDecreasingList<E>reverse()booleanset(long index, E element)XDecreasingList<E>set(long index, E[] elements, int offset, int length)XDecreasingList<E>set(long index, XGettingSequence<? extends E> elements, long offset, long length)XDecreasingList<E>setAll(long index, E... elements)voidsetFirst(E element)EsetGet(long index, E element)voidsetLast(E element)XSortableSequence<E>shiftBy(long sourceIndex, long distance)XSortableSequence<E>shiftBy(long sourceIndex, long distance, long length)XSortableSequence<E>shiftTo(long sourceIndex, long targetIndex)XSortableSequence<E>shiftTo(long sourceIndex, long targetIndex, long length)XDecreasingList<E>sort(Comparator<? super E> comparator)longsubstitute(Function<? super E,? extends E> mapper)longsubstitute(Predicate<? super E> predicate, Function<E,E> mapper)XDecreasingList<E>swap(long indexA, long indexB)XDecreasingList<E>swap(long indexA, long indexB, long length)SubListProcessor<E>toReversed()voidtruncate()Clears (and reinitializes if needed) this collection in the fastest possible way, i.e.SubListView<E>view(long fromIndex, long toIndex)-
Methods inherited from class one.microstream.collections.SubListView
applies, at, contains, containsAll, containsId, containsSearched, copySelection, copyTo, count, countBy, distinct, distinct, equality, equals, equalsContent, except, filterTo, first, get, getEndIndex, hasVolatileElements, immure, indexBy, indexOf, intersect, isEmpty, isFull, isSorted, iterate, iterateIndexed, iterator, join, last, lastIndexBy, lastIndexOf, listIterator, listIterator, max, maximumCapacity, maxIndex, min, minIndex, nullAllowed, nullContained, peek, poll, remainingCapacity, scan, search, seek, size, toArray, toArray, union, view
-
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.CapacityCarrying
isFull, maximumCapacity, remainingCapacity
-
Methods inherited from interface one.microstream.collections.interfaces.ExtendedCollection
nullAllowed
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface one.microstream.collections.types.XGettingCollection
applies, contains, containsAll, containsId, containsSearched, copyTo, count, countBy, distinct, distinct, equality, equals, equals, equalsContent, except, filterTo, hashCode, hasVolatileElements, intersect, intSize, iterator, join, max, min, nullContained, search, seek, size, toArray, toArray, union
-
Methods inherited from interface one.microstream.collections.types.XGettingList
immure, listIterator, listIterator, view
-
Methods inherited from interface one.microstream.collections.types.XGettingSequence
at, copySelection, first, get, hasIndex, indexBy, indexOf, isSorted, last, lastIndexBy, lastIndexOf, maxIndex, minIndex, peek, poll, scan
-
Methods inherited from interface one.microstream.collections.types.XIndexIterable
iterateIndexed
-
Methods inherited from interface one.microstream.collections.types.XProcessingBag
immure, view
-
Methods inherited from interface one.microstream.collections.types.XProcessingCollection
iterate
-
-
-
-
Constructor Detail
-
SubListProcessor
public SubListProcessor(XProcessingList<E> list, long fromIndex, long toIndex)
-
-
Method Detail
-
clear
public final void clear()
Description copied from interface:XRemovingCollectionClears all elements from the collection while leaving the capacity as it is.- Specified by:
clearin interfaceClearable- Specified by:
clearin interfaceXRemovingCollection<E>
-
process
public final <P extends Consumer<? super E>> P process(P procedure)
- Specified by:
processin interfaceProcessable<E>
-
removeDuplicates
public final long removeDuplicates(Equalator<? super E> equalator)
- Specified by:
removeDuplicatesin interfaceXProcessingCollection<E>
-
remove
public final long remove(E element)
- Specified by:
removein interfaceXRemovingCollection<E>
-
removeAll
public final long removeAll(XGettingCollection<? extends E> samples)
- Specified by:
removeAllin interfaceXRemovingCollection<E>
-
removeDuplicates
public final long removeDuplicates()
- Specified by:
removeDuplicatesin interfaceXRemovingCollection<E>
-
retrieve
public final E retrieve(E element)
- Specified by:
retrievein interfaceXProcessingCollection<E>
-
retrieveBy
public final E retrieveBy(Predicate<? super E> predicate)
- Specified by:
retrieveByin interfaceXProcessingCollection<E>
-
removeOne
public final boolean removeOne(E element)
- Specified by:
removeOnein interfaceXRemovingCollection<E>
-
retainAll
public final long retainAll(XGettingCollection<? extends E> samples)
- Specified by:
retainAllin interfaceXRemovingCollection<E>
-
removeBy
public final long removeBy(Predicate<? super E> predicate)
- Specified by:
removeByin interfaceXProcessingCollection<E>
-
truncate
public final void truncate()
Description copied from interface:XRemovingCollectionClears (and reinitializes if needed) this collection in the fastest possible way, i.e. by allocating a new and empty internal storage of default capacity. The collection will be empty after calling this method.- Specified by:
truncatein interfaceTruncateable- Specified by:
truncatein interfaceXRemovingCollection<E>
-
range
public final SubListProcessor<E> range(long fromIndex, long toIndex)
- Specified by:
rangein interfaceXDecreasingList<E>- Specified by:
rangein interfaceXDecreasingSequence<E>- Specified by:
rangein interfaceXGettingList<E>- Specified by:
rangein interfaceXGettingSequence<E>- Specified by:
rangein interfaceXSettingList<E>- Specified by:
rangein interfaceXSettingSequence<E>- Overrides:
rangein classSubListView<E>
-
consolidate
public final long consolidate()
Description copied from interface:XRemovingCollectionConsolidates the internal storage of this collection by discarding all elements of the internal storage that have become obsolete or otherwise unneeded anymore. (e.g.WeakReferenceentries whose reference has been cleared).If this is not possible or not needed in the concrete implementation, this method does nothing and returns 0.
- Specified by:
consolidatein interfaceConsolidatableCollection- Specified by:
consolidatein interfaceXRemovingCollection<E>- Returns:
- the number of discarded entries.
-
moveTo
public final <C extends Consumer<? super E>> C moveTo(C target, Predicate<? super E> predicate)
- Specified by:
moveToin interfaceXProcessingCollection<E>
-
optimize
public final long optimize()
Description copied from interface:XRemovingCollectionOptimizes internal memory usage by rebuilding the storage to only occupy as much memory as needed to store the currently contained elements in terms of the collection's current memory usage configuration (e.g. hash density).If this is not possible or not needed in the concreate implementation, this method does nothing.
Note that this method can consume a considerable amount of time depending on the implementation and should only be called intentionally and accurately when reducing occupied memory is needed.
- Specified by:
optimizein interfaceOptimizableCollection- Specified by:
optimizein interfaceXRemovingCollection<E>- Returns:
- the amount of elements that can be added before the internal storage has to be adjusted.
-
moveSelection
public final <C extends Consumer<? super E>> C moveSelection(C target, long... indices)
- Specified by:
moveSelectionin interfaceXProcessingSequence<E>
-
removeAt
public final E removeAt(long index) throws UnsupportedOperationException
- Specified by:
removeAtin interfaceXProcessingSequence<E>- Throws:
UnsupportedOperationException
-
fetch
public final E fetch()
- Specified by:
fetchin interfaceXProcessingCollection<E>
-
pop
public final E pop()
- Specified by:
popin interfaceXProcessingSequence<E>
-
pinch
public final E pinch()
- Specified by:
pinchin interfaceXProcessingCollection<E>
-
pick
public final E pick()
- Specified by:
pickin interfaceXProcessingSequence<E>
-
removeRange
public final SubListProcessor<E> removeRange(long startIndex, long length)
- Specified by:
removeRangein interfaceXRemovingSequence<E>
-
retainRange
public final SubListProcessor<E> retainRange(long startIndex, long length)
- Specified by:
retainRangein interfaceXRemovingSequence<E>
-
removeSelection
public final long removeSelection(long[] indices)
- Specified by:
removeSelectionin interfaceXRemovingSequence<E>
-
toReversed
public final SubListProcessor<E> toReversed()
- Specified by:
toReversedin interfaceXDecreasingList<E>- Specified by:
toReversedin interfaceXDecreasingSequence<E>- Specified by:
toReversedin interfaceXGettingList<E>- Specified by:
toReversedin interfaceXGettingSequence<E>- Specified by:
toReversedin interfaceXProcessingList<E>- Specified by:
toReversedin interfaceXProcessingSequence<E>- Specified by:
toReversedin interfaceXSettingList<E>- Specified by:
toReversedin interfaceXSettingSequence<E>- Specified by:
toReversedin interfaceXSortableSequence<E>- Overrides:
toReversedin classSubListView<E>
-
copy
public final SubListProcessor<E> copy()
Description copied from interface:XGettingSequenceCreates a true copy of this list which references th same elements in the same order as this list does at the time the method is called. The elements themselves are NOT copied (no deep copying).
The type of the returned list is the same as of this list if possible (i.e.: a SubList can not meaningful return a true copy that references its elements but still is a SubList)- Specified by:
copyin interfaceCopyable- Specified by:
copyin interfaceXDecreasingList<E>- Specified by:
copyin interfaceXDecreasingSequence<E>- Specified by:
copyin interfaceXGettingBag<E>- Specified by:
copyin interfaceXGettingCollection<E>- Specified by:
copyin interfaceXGettingList<E>- Specified by:
copyin interfaceXGettingSequence<E>- Specified by:
copyin interfaceXProcessingBag<E>- Specified by:
copyin interfaceXProcessingList<E>- Specified by:
copyin interfaceXReplacingBag<E>- Specified by:
copyin interfaceXSettingList<E>- Specified by:
copyin interfaceXSettingSequence<E>- Specified by:
copyin interfaceXSortableSequence<E>- Overrides:
copyin classSubListView<E>- Returns:
- a copy of this list
-
nullRemove
public final long nullRemove()
- Specified by:
nullRemovein interfaceXRemovingCollection<E>
-
view
public final SubListView<E> view(long fromIndex, long toIndex)
- Specified by:
viewin interfaceXGettingList<E>- Specified by:
viewin interfaceXGettingSequence<E>- Specified by:
viewin interfaceXProcessingSequence<E>- Overrides:
viewin classSubListView<E>
-
old
public final one.microstream.collections.SubListProcessor.OldSubListProcessor<E> old()
- Specified by:
oldin interfaceXGettingCollection<E>- Specified by:
oldin interfaceXGettingList<E>- Overrides:
oldin classSubListView<E>
-
replaceOne
public final boolean replaceOne(E element, E replacement)
- Specified by:
replaceOnein interfaceXReplacingBag<E>
-
replace
public final long replace(E element, E replacement)
- Specified by:
replacein interfaceXReplacingBag<E>
-
replaceAll
public final long replaceAll(XGettingCollection<? extends E> elements, E replacement)
- Specified by:
replaceAllin interfaceXReplacingBag<E>
-
replaceOne
public final boolean replaceOne(Predicate<? super E> predicate, E substitute)
- Specified by:
replaceOnein interfaceXReplacingBag<E>
-
replace
public final long replace(Predicate<? super E> predicate, E substitute)
- Specified by:
replacein interfaceXReplacingBag<E>
-
substitute
public final long substitute(Function<? super E,? extends E> mapper)
- Specified by:
substitutein interfaceXReplacingCollection<E>
-
substitute
public final long substitute(Predicate<? super E> predicate, Function<E,E> mapper)
- Specified by:
substitutein interfaceXReplacingBag<E>
-
set
public final boolean set(long index, E element) throws IndexOutOfBoundsException, ArrayIndexOutOfBoundsException- Specified by:
setin interfaceXSettingSequence<E>- Throws:
IndexOutOfBoundsExceptionArrayIndexOutOfBoundsException
-
setGet
public final E setGet(long index, E element)
- Specified by:
setGetin interfaceXSettingSequence<E>
-
setFirst
public final void setFirst(E element)
- Specified by:
setFirstin interfaceXSettingSequence<E>
-
setLast
public final void setLast(E element)
- Specified by:
setLastin interfaceXSettingSequence<E>
-
shiftTo
public final XSortableSequence<E> shiftTo(long sourceIndex, long targetIndex)
- Specified by:
shiftToin interfaceXOrderingSequence<E>- Specified by:
shiftToin interfaceXSortableSequence<E>
-
shiftTo
public final XSortableSequence<E> shiftTo(long sourceIndex, long targetIndex, long length)
- Specified by:
shiftToin interfaceXOrderingSequence<E>- Specified by:
shiftToin interfaceXSortableSequence<E>
-
shiftBy
public final XSortableSequence<E> shiftBy(long sourceIndex, long distance)
- Specified by:
shiftByin interfaceXOrderingSequence<E>- Specified by:
shiftByin interfaceXSortableSequence<E>
-
shiftBy
public final XSortableSequence<E> shiftBy(long sourceIndex, long distance, long length)
- Specified by:
shiftByin interfaceXOrderingSequence<E>- Specified by:
shiftByin interfaceXSortableSequence<E>
-
setAll
@SafeVarargs public final XDecreasingList<E> setAll(long index, E... elements)
- Specified by:
setAllin interfaceXDecreasingList<E>- Specified by:
setAllin interfaceXDecreasingSequence<E>- Specified by:
setAllin interfaceXSettingList<E>- Specified by:
setAllin interfaceXSettingSequence<E>
-
set
public final XDecreasingList<E> set(long index, E[] elements, int offset, int length)
- Specified by:
setin interfaceXDecreasingList<E>- Specified by:
setin interfaceXDecreasingSequence<E>- Specified by:
setin interfaceXSettingList<E>- Specified by:
setin interfaceXSettingSequence<E>
-
set
public final XDecreasingList<E> set(long index, XGettingSequence<? extends E> elements, long offset, long length)
- Specified by:
setin interfaceXDecreasingList<E>- Specified by:
setin interfaceXDecreasingSequence<E>- Specified by:
setin interfaceXSettingList<E>- Specified by:
setin interfaceXSettingSequence<E>
-
swap
public final XDecreasingList<E> swap(long indexA, long indexB)
- Specified by:
swapin interfaceXDecreasingList<E>- Specified by:
swapin interfaceXDecreasingSequence<E>- Specified by:
swapin interfaceXOrderingSequence<E>- Specified by:
swapin interfaceXSettingList<E>- Specified by:
swapin interfaceXSettingSequence<E>- Specified by:
swapin interfaceXSortableSequence<E>
-
swap
public final XDecreasingList<E> swap(long indexA, long indexB, long length)
- Specified by:
swapin interfaceXDecreasingList<E>- Specified by:
swapin interfaceXDecreasingSequence<E>- Specified by:
swapin interfaceXOrderingSequence<E>- Specified by:
swapin interfaceXSettingList<E>- Specified by:
swapin interfaceXSettingSequence<E>- Specified by:
swapin interfaceXSortableSequence<E>
-
reverse
public final XDecreasingList<E> reverse()
- Specified by:
reversein interfaceXDecreasingList<E>- Specified by:
reversein interfaceXDecreasingSequence<E>- Specified by:
reversein interfaceXOrderingSequence<E>- Specified by:
reversein interfaceXSettingList<E>- Specified by:
reversein interfaceXSettingSequence<E>- Specified by:
reversein interfaceXSortableSequence<E>
-
fill
public final XDecreasingList<E> fill(long offset, long length, E element)
- Specified by:
fillin interfaceXDecreasingList<E>- Specified by:
fillin interfaceXSettingList<E>
-
sort
public final XDecreasingList<E> sort(Comparator<? super E> comparator)
- Specified by:
sortin interfaceSortable<E>- Specified by:
sortin interfaceXDecreasingList<E>- Specified by:
sortin interfaceXDecreasingSequence<E>- Specified by:
sortin interfaceXSettingList<E>- Specified by:
sortin interfaceXSettingSequence<E>- Specified by:
sortin interfaceXSortableSequence<E>
-
-