Class SubProcessor<E>
- All Implemented Interfaces:
Iterable<E>
,CapacityCarrying
,ConsolidatableCollection
,ExtendedCollection<E>
,ExtendedSequence<E>
,OptimizableCollection
,ReleasingCollection<E>
,Sized
,Truncateable
,XGettingCollection<E>
,XGettingSequence<E>
,XIndexIterable<E>
,XIterable<E>
,XJoinable<E>
,XProcessingCollection<E>
,XProcessingSequence<E>
,XRemovingCollection<E>
,XRemovingSequence<E>
,Processable<E>
,Clearable
,Copyable
public class SubProcessor<E> extends SubView<E> implements XProcessingSequence<E>
-
Nested Class Summary
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.XGettingCollection
XGettingCollection.Creator<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.XProcessingSequence
XProcessingSequence.Factory<E>
-
Constructor Summary
Constructors Constructor Description SubProcessor()
-
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.SubProcessor<E>
copy()
Creates a true copy of this list which references the same elements in the same order as this list does at the time the method is called.E
fetch()
<C extends Consumer<? super E>>
CmoveSelection(C target, long... indices)
<C extends Consumer<? super E>>
CmoveTo(C target, Predicate<? super E> predicate)
long
nullRemove()
OldCollection<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)
long
remove(E element)
long
removeAll(XGettingCollection<? extends E> elements)
E
removeAt(long index)
long
removeBy(Predicate<? super E> predicate)
long
removeDuplicates()
long
removeDuplicates(Equalator<? super E> equalator)
boolean
removeOne(E element)
XProcessingSequence<E>
removeRange(long offset, long length)
long
removeSelection(long[] indices)
long
retainAll(XGettingCollection<? extends E> elements)
Removing all elements except the ones contained in the given elements-collection.XProcessingSequence<E>
retainRange(long offset, long length)
Removing all elements but the ones from the offset (basically start index) to the offset+length (end index).E
retrieve(E element)
E
retrieveBy(Predicate<? super E> predicate)
SubProcessor<E>
toReversed()
Creates a newXGettingSequence
with the reversed order of elements.void
truncate()
Clears (and reinitializes if needed) this collection in the fastest possible way, i.e.SubProcessor<E>
view()
Creates a view of this collection and returns it.Methods inherited from class one.microstream.collections.SubView
applies, at, contains, containsAll, containsId, containsSearched, copySelection, copyTo, count, countBy, distinct, distinct, equality, equals, equalsContent, except, filterTo, first, get, hasVolatileElements, immure, indexBy, indexOf, intersect, isEmpty, isFull, isSorted, iterate, iterateIndexed, iterator, join, last, lastIndexBy, lastIndexOf, max, maximumCapacity, maxIndex, min, minIndex, nullAllowed, nullContained, peek, poll, range, 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 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.XGettingSequence
at, copySelection, first, get, hasIndex, immure, indexBy, indexOf, isSorted, last, lastIndexBy, lastIndexOf, maxIndex, minIndex, peek, poll, range, scan
-
Constructor Details
-
SubProcessor
public SubProcessor()
-
-
Method Details
-
fetch
- Specified by:
fetch
in interfaceXProcessingCollection<E>
-
moveSelection
- Specified by:
moveSelection
in interfaceXProcessingSequence<E>
-
pick
- Specified by:
pick
in interfaceXProcessingSequence<E>
-
pinch
- Specified by:
pinch
in interfaceXProcessingCollection<E>
-
pop
- Specified by:
pop
in interfaceXProcessingSequence<E>
-
removeAt
- Specified by:
removeAt
in interfaceXProcessingSequence<E>
-
removeRange
- Specified by:
removeRange
in interfaceXRemovingSequence<E>
-
retainRange
Description copied from interface:XRemovingSequence
Removing all elements but the ones from the offset (basically start index) to the offset+length (end index).- Specified by:
retainRange
in interfaceXRemovingSequence<E>
- Parameters:
offset
- is the index of the first element to retainlength
- is the amount of elements to retain- Returns:
- this
-
removeSelection
public long removeSelection(long[] indices)- Specified by:
removeSelection
in interfaceXRemovingSequence<E>
-
retrieve
- Specified by:
retrieve
in interfaceXProcessingCollection<E>
-
retrieveBy
- Specified by:
retrieveBy
in interfaceXProcessingCollection<E>
-
removeOne
- Specified by:
removeOne
in interfaceXRemovingCollection<E>
-
moveTo
- Specified by:
moveTo
in interfaceXProcessingCollection<E>
-
process
- Specified by:
process
in interfaceProcessable<E>
-
removeBy
- Specified by:
removeBy
in interfaceXProcessingCollection<E>
-
removeDuplicates
- Specified by:
removeDuplicates
in interfaceXProcessingCollection<E>
-
clear
public 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>
-
consolidate
public long consolidate()Description copied from interface:ConsolidatableCollection
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).- Specified by:
consolidate
in interfaceConsolidatableCollection
- Specified by:
consolidate
in interfaceXRemovingCollection<E>
- Returns:
- the number of discarded entries.
-
nullRemove
public long nullRemove()- Specified by:
nullRemove
in interfaceXRemovingCollection<E>
-
optimize
public 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.
-
remove
- Specified by:
remove
in interfaceXRemovingCollection<E>
-
removeAll
- Specified by:
removeAll
in interfaceXRemovingCollection<E>
-
removeDuplicates
public long removeDuplicates()- Specified by:
removeDuplicates
in interfaceXRemovingCollection<E>
-
retainAll
Description copied from interface:XRemovingCollection
Removing all elements except the ones contained in the given elements-collection.Basically intersect this collection with the given collection and only keeping the resulting elements.
- Specified by:
retainAll
in interfaceXRemovingCollection<E>
- Parameters:
elements
- to retain- Returns:
- Amount of deleted elements
-
truncate
public 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>
-
copy
Description copied from interface:XGettingSequence
Creates a true copy of this list which references the 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) -
view
Description copied from interface:XGettingCollection
Creates a view of this collection and returns it. It is a read-only collection, which wraps around this collection and only allows read methods.A view is different from immutable collection (
XGettingCollection.immure()
) in the way, that changes in this collection are still affecting the view. The immutable collection on the other hand has no reference to this collection and changes therefore do not affect the immutable collection.- Specified by:
view
in interfaceXGettingCollection<E>
- Specified by:
view
in interfaceXGettingSequence<E>
- Overrides:
view
in classSubView<E>
- Returns:
- new read-only collection to view this collection
-
old
-
toReversed
Description copied from interface:XGettingSequence
Creates a newXGettingSequence
with the reversed order of elements.This method creates a new collection and does not change the existing collection.
- Specified by:
toReversed
in interfaceXGettingSequence<E>
- Specified by:
toReversed
in interfaceXProcessingSequence<E>
- Overrides:
toReversed
in classSubView<E>
- Returns:
- New copy of the collection
-