Class BooleanBigSpliterators.EarlyBindingSizeIndexBasedSpliterator
- All Implemented Interfaces:
it.unimi.dsi.fastutil.booleans.BooleanSpliterator,Spliterator<Boolean>,Spliterator.OfPrimitive<Boolean,it.unimi.dsi.fastutil.booleans.BooleanConsumer, it.unimi.dsi.fastutil.booleans.BooleanSpliterator>
- Enclosing class:
BooleanBigSpliterators
This class implements an early binding strategy for getMaxPos(). The last index
this spliterator covers is fixed at construction time and does not vary on changes to the
backing data store. This should usually be the size of the
backing data store (until a split at least), hence the class' name, but this is not required.
As the abstract methods in this class are used in inner loops, it is generally a
good idea to override the class as final as to encourage the JVM to inline
them (or alternatively, override the abstract methods as final).
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final longThe maximumBooleanBigSpliterators.AbstractIndexBasedSpliterator.poscan beFields inherited from class it.unimi.dsi.fastutil.booleans.BooleanBigSpliterators.AbstractIndexBasedSpliterator
posFields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEarlyBindingSizeIndexBasedSpliterator(long initialPos, long maxPos) -
Method Summary
Modifier and TypeMethodDescriptionprotected final longThe maximum pos can be, and is the logical end (exclusive) of the "range".Methods inherited from class it.unimi.dsi.fastutil.booleans.BooleanBigSpliterators.AbstractIndexBasedSpliterator
characteristics, computeSplitPoint, estimateSize, forEachRemaining, get, makeForSplit, skip, tryAdvance, trySplitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanSpliterator
forEachRemaining, getComparator, tryAdvanceMethods inherited from interface java.util.Spliterator
getExactSizeIfKnown, hasCharacteristics
-
Field Details
-
maxPos
protected final long maxPosThe maximumBooleanBigSpliterators.AbstractIndexBasedSpliterator.poscan be
-
-
Constructor Details
-
EarlyBindingSizeIndexBasedSpliterator
protected EarlyBindingSizeIndexBasedSpliterator(long initialPos, long maxPos)
-
-
Method Details
-
getMaxPos
protected final long getMaxPos()Description copied from class:BooleanBigSpliterators.AbstractIndexBasedSpliteratorThe maximum pos can be, and is the logical end (exclusive) of the "range".If pos is equal to the return of this method, this means the last element has been returned and the next call to
BooleanBigSpliterators.AbstractIndexBasedSpliterator.tryAdvance(it.unimi.dsi.fastutil.booleans.BooleanConsumer)will returnfalse.Usually set return the parent collection's size, but does not have to be (for example, sublists and subranges).
This method allows the implementation to decide how it binds on the size (late or early). However,
BooleanBigSpliterators.EarlyBindingSizeIndexBasedSpliteratorandBooleanBigSpliterators.LateBindingSizeIndexBasedSpliteratorgive an implementation of this method for the two most common strategies.- Specified by:
getMaxPosin classBooleanBigSpliterators.AbstractIndexBasedSpliterator
-