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 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.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.Efetch()Remove and retrieve first or throw IndexOutOfBoundsException if empty (fetch ~= first).<C extends Consumer<? super E>>
CmoveSelection(C target, long... indices)<C extends Consumer<? super E>>
CmoveTo(C target, Predicate<? super E> predicate)longnullRemove()OldCollection<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()Remove and retrieve last or null if empty (like easy extraction from collection's end).Epinch()Remove and retrieve first or null if empty (like forceful extraction from collection's base)Epop()Remove and retrieve last or throw IndexOutOfBoundsException if empty (stack conceptional pop).<P extends Consumer<? super E>>
Pprocess(P procedure)longremove(E element)longremoveAll(XGettingCollection<? extends E> elements)EremoveAt(long index)Remove and retrieve element at index or throw IndexOutOfBoundsException if invalid.longremoveBy(Predicate<? super E> predicate)longremoveDuplicates()longremoveDuplicates(Equalator<? super E> equalator)booleanremoveOne(E element)XProcessingSequence<E>removeRange(long offset, long length)longremoveSelection(long[] indices)longretainAll(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).Eretrieve(E element)Remove and retrieve first occurrence.EretrieveBy(Predicate<? super E> predicate)Remove and retrieve first item that match the predicate.SubProcessor<E>toReversed()Creates a newXGettingSequencewith the reversed order of elements.voidtruncate()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, viewMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface one.microstream.collections.interfaces.CapacityCarrying
isFull, maximumCapacity, remainingCapacityMethods inherited from interface one.microstream.collections.interfaces.ExtendedCollection
nullAllowedMethods 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, unionMethods 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
Description copied from interface:XProcessingCollectionRemove and retrieve first or throw IndexOutOfBoundsException if empty (fetch ~= first).- Specified by:
fetchin interfaceXProcessingCollection<E>- Returns:
- First item
-
moveSelection
- Specified by:
moveSelectionin interfaceXProcessingSequence<E>
-
pick
Description copied from interface:XProcessingSequenceRemove and retrieve last or null if empty (like easy extraction from collection's end).- Specified by:
pickin interfaceXProcessingSequence<E>- Returns:
- Last item or null if empty.
-
pinch
Description copied from interface:XProcessingCollectionRemove and retrieve first or null if empty (like forceful extraction from collection's base)- Specified by:
pinchin interfaceXProcessingCollection<E>- Returns:
- First item or null when empty
-
pop
Description copied from interface:XProcessingSequenceRemove and retrieve last or throw IndexOutOfBoundsException if empty (stack conceptional pop).- Specified by:
popin interfaceXProcessingSequence<E>- Returns:
- Last item or IndexOutOfBoundsException if empty.
-
removeAt
Description copied from interface:XProcessingSequenceRemove and retrieve element at index or throw IndexOutOfBoundsException if invalid.- Specified by:
removeAtin interfaceXProcessingSequence<E>- Parameters:
index- index of item to be retrieved.- Returns:
- Item at index or IndexOutOfBoundsException if invalid.
-
removeRange
- Specified by:
removeRangein interfaceXRemovingSequence<E>
-
retainRange
Description copied from interface:XRemovingSequenceRemoving all elements but the ones from the offset (basically start index) to the offset+length (end index).- Specified by:
retainRangein 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:
removeSelectionin interfaceXRemovingSequence<E>
-
retrieve
Description copied from interface:XProcessingCollectionRemove and retrieve first occurrence.- Specified by:
retrievein interfaceXProcessingCollection<E>- Parameters:
element- The element to retrieve- Returns:
- The item.
-
retrieveBy
Description copied from interface:XProcessingCollectionRemove and retrieve first item that match the predicate.- Specified by:
retrieveByin interfaceXProcessingCollection<E>- Parameters:
predicate- The Predicate for the search.- Returns:
- The item matched (and is also removed)
-
removeOne
- Specified by:
removeOnein interfaceXRemovingCollection<E>
-
moveTo
- Specified by:
moveToin interfaceXProcessingCollection<E>
-
process
- Specified by:
processin interfaceProcessable<E>
-
removeBy
- Specified by:
removeByin interfaceXProcessingCollection<E>
-
removeDuplicates
- Specified by:
removeDuplicatesin interfaceXProcessingCollection<E>
-
clear
public 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>
-
consolidate
public long consolidate()Description copied from interface:ConsolidatableCollectionConsolidates 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.
-
nullRemove
public long nullRemove()- Specified by:
nullRemovein interfaceXRemovingCollection<E>
-
optimize
public 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 concrete 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.
-
remove
- Specified by:
removein interfaceXRemovingCollection<E>
-
removeAll
- Specified by:
removeAllin interfaceXRemovingCollection<E>
-
removeDuplicates
public long removeDuplicates()- Specified by:
removeDuplicatesin interfaceXRemovingCollection<E>
-
retainAll
Description copied from interface:XRemovingCollectionRemoving 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:
retainAllin interfaceXRemovingCollection<E>- Parameters:
elements- to retain- Returns:
- Amount of deleted elements
-
truncate
public 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>
-
copy
Description copied from interface:XGettingSequenceCreates 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:XGettingCollectionCreates 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:
viewin interfaceXGettingCollection<E>- Specified by:
viewin interfaceXGettingSequence<E>- Overrides:
viewin classSubView<E>- Returns:
- new read-only collection to view this collection
-
old
-
toReversed
Description copied from interface:XGettingSequenceCreates a newXGettingSequencewith the reversed order of elements.This method creates a new collection and does not change the existing collection.
- Specified by:
toReversedin interfaceXGettingSequence<E>- Specified by:
toReversedin interfaceXProcessingSequence<E>- Overrides:
toReversedin classSubView<E>- Returns:
- New copy of the collection
-