Package one.microstream.collections
Class SubCollector<E>
java.lang.Object
one.microstream.collections.SubView<E>
one.microstream.collections.SubCollector<E>
- All Implemented Interfaces:
Iterable<E>
,Consumer<E>
,CapacityCarrying
,CapacityExtendable
,ExtendedCollection<E>
,ExtendedSequence<E>
,OptimizableCollection
,Sized
,XAddingCollection<E>
,XAddingSequence<E>
,XGettingCollection<E>
,XGettingSequence<E>
,XIndexIterable<E>
,XIterable<E>
,XJoinable<E>
,XPuttingCollection<E>
,XPuttingSequence<E>
,Copyable
public class SubCollector<E> extends SubView<E> implements XPuttingSequence<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.XPuttingSequence
XPuttingSequence.Creator<E>
-
Constructor Summary
Constructors Constructor Description SubCollector()
-
Method Summary
Modifier and Type Method Description void
accept(E element)
boolean
add(E element)
Adds the passed element.SubCollector<E>
addAll(E... elements)
SubCollector<E>
addAll(E[] elements, int srcStartIndex, int srcLength)
SubCollector<E>
addAll(XGettingCollection<? extends E> elements)
long
currentCapacity()
Returns the current amount of elements this instance can hold before a storage rebuild becomes necessary.SubCollector<E>
ensureCapacity(long minimalCapacity)
SubCollector<E>
ensureFreeCapacity(long minimalFreeCapacity)
Ensures that the next minimalFreeCapacity elements can be actually added in a fast way, meaning for example no internal storage rebuild will be necessary.boolean
nullAdd()
boolean
nullPut()
long
optimize()
Optimizes the internal storage of this collection and returns the storage size of the collection after the process is complete.boolean
put(E element)
Adds the specified element to this collection if it is not already present (optional operation).SubCollector<E>
putAll(E... elements)
Adds the specified elements to this collection if it is not already present (optional operation).SubCollector<E>
putAll(E[] elements, int srcStartIndex, int srcLength)
Adds the specified elements to this collection if it is not already present (optional operation).
Only the elements with indizes from the srcStartIndex to the srcStartIndex+srcLength are put in the collection.SubCollector<E>
putAll(XGettingCollection<? extends E> elements)
Adds the specified elements to this collection if it is not already present (optional operation).Methods inherited from class one.microstream.collections.SubView
applies, at, contains, containsAll, containsId, containsSearched, copy, 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, old, peek, poll, range, remainingCapacity, scan, search, seek, size, toArray, toArray, toReversed, union, view, 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.CapacityExtendable
currentFreeCapacity
Methods inherited from interface one.microstream.collections.interfaces.ExtendedCollection
nullAllowed
Methods inherited from interface one.microstream.collections.types.XGettingCollection
equals, hashCode, intSize
-
Constructor Details
-
SubCollector
public SubCollector()
-
-
Method Details
-
putAll
Description copied from interface:XPuttingCollection
Adds the specified elements to this collection if it is not already present (optional operation).- Specified by:
putAll
in interfaceXPuttingCollection<E>
- Specified by:
putAll
in interfaceXPuttingSequence<E>
- Parameters:
elements
- to add- Returns:
- this
-
putAll
Description copied from interface:XPuttingCollection
Adds the specified elements to this collection if it is not already present (optional operation).
Only the elements with indizes from the srcStartIndex to the srcStartIndex+srcLength are put in the collection.- Specified by:
putAll
in interfaceXPuttingCollection<E>
- Specified by:
putAll
in interfaceXPuttingSequence<E>
- Parameters:
elements
- to addsrcStartIndex
- start index of elements-array to add to collectionsrcLength
- length of elements-array to add to collection- Returns:
- this
-
putAll
Description copied from interface:XPuttingCollection
Adds the specified elements to this collection if it is not already present (optional operation).- Specified by:
putAll
in interfaceXPuttingCollection<E>
- Specified by:
putAll
in interfaceXPuttingSequence<E>
- Parameters:
elements
- to add- Returns:
- this
-
nullPut
public final boolean nullPut()- Specified by:
nullPut
in interfaceXPuttingCollection<E>
-
put
Description copied from interface:XPuttingCollection
Adds the specified element to this collection if it is not already present (optional operation).- Specified by:
put
in interfaceXPuttingCollection<E>
- Parameters:
element
- to add- Returns:
- true if this collection did not already contain the specified element
-
add
Description copied from interface:XAddingCollection
Adds the passed element.- Specified by:
add
in interfaceXAddingCollection<E>
- Parameters:
element
- to add- Returns:
true
if element was added;false
if not
-
addAll
- Specified by:
addAll
in interfaceXAddingCollection<E>
- Specified by:
addAll
in interfaceXAddingSequence<E>
-
addAll
- Specified by:
addAll
in interfaceXAddingCollection<E>
- Specified by:
addAll
in interfaceXAddingSequence<E>
-
addAll
- Specified by:
addAll
in interfaceXAddingCollection<E>
- Specified by:
addAll
in interfaceXAddingSequence<E>
-
accept
-
nullAdd
public final boolean nullAdd()- Specified by:
nullAdd
in interfaceXAddingCollection<E>
-
currentCapacity
public final long currentCapacity()Description copied from interface:CapacityExtendable
Returns the current amount of elements this instance can hold before a storage rebuild becomes necessary.For carrier implementations that don't have a concept of storage rebuilding (like linked list for example) this method returns the same value as
CapacityCarrying.maximumCapacity()
.- Specified by:
currentCapacity
in interfaceCapacityExtendable
- Returns:
- the current capacity of this instance before a rebuild is required.
-
ensureCapacity
- Specified by:
ensureCapacity
in interfaceCapacityExtendable
-
ensureFreeCapacity
Description copied from interface:CapacityExtendable
Ensures that the next minimalFreeCapacity elements can be actually added in a fast way, meaning for example no internal storage rebuild will be necessary.- Specified by:
ensureFreeCapacity
in interfaceCapacityExtendable
- Parameters:
minimalFreeCapacity
- the capacity to ensure- Returns:
- this
-
optimize
public final long optimize()Description copied from interface:OptimizableCollection
Optimizes the internal storage of this collection and returns the storage size of the collection after the process is complete.- Specified by:
optimize
in interfaceOptimizableCollection
- Returns:
- the storage size of the collection after the optimzation.
-