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 void
clear()
Clears all elements from the collection while leaving the capacity as it is.long
consolidate()
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.E
fetch()
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)
long
nullRemove()
one.microstream.collections.SubListProcessor.OldSubListProcessor<E>
old()
long
optimize()
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.E
pick()
E
pinch()
E
pop()
<P extends Consumer<? super E>>
Pprocess(P procedure)
SubListProcessor<E>
range(long fromIndex, long toIndex)
long
remove(E element)
long
removeAll(XGettingCollection<? extends E> samples)
E
removeAt(long index)
long
removeBy(Predicate<? super E> predicate)
long
removeDuplicates()
long
removeDuplicates(Equalator<? super E> equalator)
boolean
removeOne(E element)
SubListProcessor<E>
removeRange(long startIndex, long length)
long
removeSelection(long[] indices)
long
replace(E element, E replacement)
long
replace(Predicate<? super E> predicate, E substitute)
long
replaceAll(XGettingCollection<? extends E> elements, E replacement)
boolean
replaceOne(E element, E replacement)
boolean
replaceOne(Predicate<? super E> predicate, E substitute)
long
retainAll(XGettingCollection<? extends E> samples)
SubListProcessor<E>
retainRange(long startIndex, long length)
E
retrieve(E element)
E
retrieveBy(Predicate<? super E> predicate)
XDecreasingList<E>
reverse()
boolean
set(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)
void
setFirst(E element)
E
setGet(long index, E element)
void
setLast(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)
long
substitute(Function<? super E,? extends E> mapper)
long
substitute(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()
void
truncate()
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:XRemovingCollection
Clears all elements from the collection while leaving the capacity as it is.- Specified by:
clear
in interfaceClearable
- Specified by:
clear
in interfaceXRemovingCollection<E>
-
process
public final <P extends Consumer<? super E>> P process(P procedure)
- Specified by:
process
in interfaceProcessable<E>
-
removeDuplicates
public final long removeDuplicates(Equalator<? super E> equalator)
- Specified by:
removeDuplicates
in interfaceXProcessingCollection<E>
-
remove
public final long remove(E element)
- Specified by:
remove
in interfaceXRemovingCollection<E>
-
removeAll
public final long removeAll(XGettingCollection<? extends E> samples)
- Specified by:
removeAll
in interfaceXRemovingCollection<E>
-
removeDuplicates
public final long removeDuplicates()
- Specified by:
removeDuplicates
in interfaceXRemovingCollection<E>
-
retrieve
public final E retrieve(E element)
- Specified by:
retrieve
in interfaceXProcessingCollection<E>
-
retrieveBy
public final E retrieveBy(Predicate<? super E> predicate)
- Specified by:
retrieveBy
in interfaceXProcessingCollection<E>
-
removeOne
public final boolean removeOne(E element)
- Specified by:
removeOne
in interfaceXRemovingCollection<E>
-
retainAll
public final long retainAll(XGettingCollection<? extends E> samples)
- Specified by:
retainAll
in interfaceXRemovingCollection<E>
-
removeBy
public final long removeBy(Predicate<? super E> predicate)
- Specified by:
removeBy
in interfaceXProcessingCollection<E>
-
truncate
public final void truncate()
Description copied from interface:XRemovingCollection
Clears (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:
truncate
in interfaceTruncateable
- Specified by:
truncate
in interfaceXRemovingCollection<E>
-
range
public final SubListProcessor<E> range(long fromIndex, long toIndex)
- Specified by:
range
in interfaceXDecreasingList<E>
- Specified by:
range
in interfaceXDecreasingSequence<E>
- Specified by:
range
in interfaceXGettingList<E>
- Specified by:
range
in interfaceXGettingSequence<E>
- Specified by:
range
in interfaceXSettingList<E>
- Specified by:
range
in interfaceXSettingSequence<E>
- Overrides:
range
in classSubListView<E>
-
consolidate
public final long consolidate()
Description copied from interface:XRemovingCollection
Consolidates the internal storage of this collection by discarding all elements of the internal storage that have become obsolete or otherwise unneeded anymore. (e.g.WeakReference
entries 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:
consolidate
in interfaceConsolidatableCollection
- Specified by:
consolidate
in 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:
moveTo
in interfaceXProcessingCollection<E>
-
optimize
public final long optimize()
Description copied from interface:XRemovingCollection
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. 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:
optimize
in interfaceOptimizableCollection
- Specified by:
optimize
in 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:
moveSelection
in interfaceXProcessingSequence<E>
-
removeAt
public final E removeAt(long index) throws UnsupportedOperationException
- Specified by:
removeAt
in interfaceXProcessingSequence<E>
- Throws:
UnsupportedOperationException
-
fetch
public final E fetch()
- Specified by:
fetch
in interfaceXProcessingCollection<E>
-
pop
public final E pop()
- Specified by:
pop
in interfaceXProcessingSequence<E>
-
pinch
public final E pinch()
- Specified by:
pinch
in interfaceXProcessingCollection<E>
-
pick
public final E pick()
- Specified by:
pick
in interfaceXProcessingSequence<E>
-
removeRange
public final SubListProcessor<E> removeRange(long startIndex, long length)
- Specified by:
removeRange
in interfaceXRemovingSequence<E>
-
retainRange
public final SubListProcessor<E> retainRange(long startIndex, long length)
- Specified by:
retainRange
in interfaceXRemovingSequence<E>
-
removeSelection
public final long removeSelection(long[] indices)
- Specified by:
removeSelection
in interfaceXRemovingSequence<E>
-
toReversed
public final SubListProcessor<E> toReversed()
- Specified by:
toReversed
in interfaceXDecreasingList<E>
- Specified by:
toReversed
in interfaceXDecreasingSequence<E>
- Specified by:
toReversed
in interfaceXGettingList<E>
- Specified by:
toReversed
in interfaceXGettingSequence<E>
- Specified by:
toReversed
in interfaceXProcessingList<E>
- Specified by:
toReversed
in interfaceXProcessingSequence<E>
- Specified by:
toReversed
in interfaceXSettingList<E>
- Specified by:
toReversed
in interfaceXSettingSequence<E>
- Specified by:
toReversed
in interfaceXSortableSequence<E>
- Overrides:
toReversed
in classSubListView<E>
-
copy
public final SubListProcessor<E> copy()
Description copied from interface:XGettingSequence
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. 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:
copy
in interfaceCopyable
- Specified by:
copy
in interfaceXDecreasingList<E>
- Specified by:
copy
in interfaceXDecreasingSequence<E>
- Specified by:
copy
in interfaceXGettingBag<E>
- Specified by:
copy
in interfaceXGettingCollection<E>
- Specified by:
copy
in interfaceXGettingList<E>
- Specified by:
copy
in interfaceXGettingSequence<E>
- Specified by:
copy
in interfaceXProcessingBag<E>
- Specified by:
copy
in interfaceXProcessingList<E>
- Specified by:
copy
in interfaceXReplacingBag<E>
- Specified by:
copy
in interfaceXSettingList<E>
- Specified by:
copy
in interfaceXSettingSequence<E>
- Specified by:
copy
in interfaceXSortableSequence<E>
- Overrides:
copy
in classSubListView<E>
- Returns:
- a copy of this list
-
nullRemove
public final long nullRemove()
- Specified by:
nullRemove
in interfaceXRemovingCollection<E>
-
view
public final SubListView<E> view(long fromIndex, long toIndex)
- Specified by:
view
in interfaceXGettingList<E>
- Specified by:
view
in interfaceXGettingSequence<E>
- Specified by:
view
in interfaceXProcessingSequence<E>
- Overrides:
view
in classSubListView<E>
-
old
public final one.microstream.collections.SubListProcessor.OldSubListProcessor<E> old()
- Specified by:
old
in interfaceXGettingCollection<E>
- Specified by:
old
in interfaceXGettingList<E>
- Overrides:
old
in classSubListView<E>
-
replaceOne
public final boolean replaceOne(E element, E replacement)
- Specified by:
replaceOne
in interfaceXReplacingBag<E>
-
replace
public final long replace(E element, E replacement)
- Specified by:
replace
in interfaceXReplacingBag<E>
-
replaceAll
public final long replaceAll(XGettingCollection<? extends E> elements, E replacement)
- Specified by:
replaceAll
in interfaceXReplacingBag<E>
-
replaceOne
public final boolean replaceOne(Predicate<? super E> predicate, E substitute)
- Specified by:
replaceOne
in interfaceXReplacingBag<E>
-
replace
public final long replace(Predicate<? super E> predicate, E substitute)
- Specified by:
replace
in interfaceXReplacingBag<E>
-
substitute
public final long substitute(Function<? super E,? extends E> mapper)
- Specified by:
substitute
in interfaceXReplacingCollection<E>
-
substitute
public final long substitute(Predicate<? super E> predicate, Function<E,E> mapper)
- Specified by:
substitute
in interfaceXReplacingBag<E>
-
set
public final boolean set(long index, E element) throws IndexOutOfBoundsException, ArrayIndexOutOfBoundsException
- Specified by:
set
in interfaceXSettingSequence<E>
- Throws:
IndexOutOfBoundsException
ArrayIndexOutOfBoundsException
-
setGet
public final E setGet(long index, E element)
- Specified by:
setGet
in interfaceXSettingSequence<E>
-
setFirst
public final void setFirst(E element)
- Specified by:
setFirst
in interfaceXSettingSequence<E>
-
setLast
public final void setLast(E element)
- Specified by:
setLast
in interfaceXSettingSequence<E>
-
shiftTo
public final XSortableSequence<E> shiftTo(long sourceIndex, long targetIndex)
- Specified by:
shiftTo
in interfaceXOrderingSequence<E>
- Specified by:
shiftTo
in interfaceXSortableSequence<E>
-
shiftTo
public final XSortableSequence<E> shiftTo(long sourceIndex, long targetIndex, long length)
- Specified by:
shiftTo
in interfaceXOrderingSequence<E>
- Specified by:
shiftTo
in interfaceXSortableSequence<E>
-
shiftBy
public final XSortableSequence<E> shiftBy(long sourceIndex, long distance)
- Specified by:
shiftBy
in interfaceXOrderingSequence<E>
- Specified by:
shiftBy
in interfaceXSortableSequence<E>
-
shiftBy
public final XSortableSequence<E> shiftBy(long sourceIndex, long distance, long length)
- Specified by:
shiftBy
in interfaceXOrderingSequence<E>
- Specified by:
shiftBy
in interfaceXSortableSequence<E>
-
setAll
@SafeVarargs public final XDecreasingList<E> setAll(long index, E... elements)
- Specified by:
setAll
in interfaceXDecreasingList<E>
- Specified by:
setAll
in interfaceXDecreasingSequence<E>
- Specified by:
setAll
in interfaceXSettingList<E>
- Specified by:
setAll
in interfaceXSettingSequence<E>
-
set
public final XDecreasingList<E> set(long index, E[] elements, int offset, int length)
- Specified by:
set
in interfaceXDecreasingList<E>
- Specified by:
set
in interfaceXDecreasingSequence<E>
- Specified by:
set
in interfaceXSettingList<E>
- Specified by:
set
in interfaceXSettingSequence<E>
-
set
public final XDecreasingList<E> set(long index, XGettingSequence<? extends E> elements, long offset, long length)
- Specified by:
set
in interfaceXDecreasingList<E>
- Specified by:
set
in interfaceXDecreasingSequence<E>
- Specified by:
set
in interfaceXSettingList<E>
- Specified by:
set
in interfaceXSettingSequence<E>
-
swap
public final XDecreasingList<E> swap(long indexA, long indexB)
- Specified by:
swap
in interfaceXDecreasingList<E>
- Specified by:
swap
in interfaceXDecreasingSequence<E>
- Specified by:
swap
in interfaceXOrderingSequence<E>
- Specified by:
swap
in interfaceXSettingList<E>
- Specified by:
swap
in interfaceXSettingSequence<E>
- Specified by:
swap
in interfaceXSortableSequence<E>
-
swap
public final XDecreasingList<E> swap(long indexA, long indexB, long length)
- Specified by:
swap
in interfaceXDecreasingList<E>
- Specified by:
swap
in interfaceXDecreasingSequence<E>
- Specified by:
swap
in interfaceXOrderingSequence<E>
- Specified by:
swap
in interfaceXSettingList<E>
- Specified by:
swap
in interfaceXSettingSequence<E>
- Specified by:
swap
in interfaceXSortableSequence<E>
-
reverse
public final XDecreasingList<E> reverse()
- Specified by:
reverse
in interfaceXDecreasingList<E>
- Specified by:
reverse
in interfaceXDecreasingSequence<E>
- Specified by:
reverse
in interfaceXOrderingSequence<E>
- Specified by:
reverse
in interfaceXSettingList<E>
- Specified by:
reverse
in interfaceXSettingSequence<E>
- Specified by:
reverse
in interfaceXSortableSequence<E>
-
fill
public final XDecreasingList<E> fill(long offset, long length, E element)
- Specified by:
fill
in interfaceXDecreasingList<E>
- Specified by:
fill
in interfaceXSettingList<E>
-
sort
public final XDecreasingList<E> sort(Comparator<? super E> comparator)
- Specified by:
sort
in interfaceSortable<E>
- Specified by:
sort
in interfaceXDecreasingList<E>
- Specified by:
sort
in interfaceXDecreasingSequence<E>
- Specified by:
sort
in interfaceXSettingList<E>
- Specified by:
sort
in interfaceXSettingSequence<E>
- Specified by:
sort
in interfaceXSortableSequence<E>
-
-