public abstract static class ShortSpliterators.EarlyBindingSizeIndexBasedSpliterator extends ShortSpliterators.AbstractIndexBasedSpliterator
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).
| Modifier and Type | Field and Description |
|---|---|
protected int |
maxPos
The maximum
ShortSpliterators.AbstractIndexBasedSpliterator.pos can be |
pos| Modifier | Constructor and Description |
|---|---|
protected |
EarlyBindingSizeIndexBasedSpliterator(int initialPos,
int maxPos) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
getMaxPos()
The maximum pos can be, and is the logical end (exclusive) of the "range".
|
characteristics, computeSplitPoint, estimateSize, forEachRemaining, get, makeForSplit, skip, tryAdvance, trySplitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected final int maxPos
ShortSpliterators.AbstractIndexBasedSpliterator.pos can beprotected EarlyBindingSizeIndexBasedSpliterator(int initialPos,
int maxPos)
protected final int getMaxPos()
ShortSpliterators.AbstractIndexBasedSpliteratorIf pos is equal to the return of this method, this means the last element has been returned and the next call to ShortSpliterators.AbstractIndexBasedSpliterator.tryAdvance(it.unimi.dsi.fastutil.shorts.ShortConsumer) will return false.
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, ShortSpliterators.EarlyBindingSizeIndexBasedSpliterator and ShortSpliterators.LateBindingSizeIndexBasedSpliterator give
an implementation of this method for the two most common strategies.
getMaxPos in class ShortSpliterators.AbstractIndexBasedSpliterator