public abstract static class CharBigSpliterators.LateBindingSizeIndexBasedSpliterator extends CharBigSpliterators.AbstractIndexBasedSpliterator
This class implements a late binding strategy. On a new, non-split instance, the
max pos will track the given data store (usually it's
size, hence the class' name). On the first
split, the last index will be read from the backing data store one
last time and then be fixed for the remaining duration of this instance.
The returned split should should also be have a constant maxPos.
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 long |
maxPos
The maximum
CharBigSpliterators.AbstractIndexBasedSpliterator.pos can be, or -1 if it hasn't been fixed yet. |
pos| Modifier | Constructor and Description |
|---|---|
protected |
LateBindingSizeIndexBasedSpliterator(long initialPos) |
protected |
LateBindingSizeIndexBasedSpliterator(long initialPos,
long fixedMaxPos) |
| Modifier and Type | Method and Description |
|---|---|
protected long |
getMaxPos()
The maximum pos can be, and is the logical end (exclusive) of the "range".
|
protected abstract long |
getMaxPosFromBackingStore()
Return the maximum pos can be dynamically tracking the backing data store.
|
it.unimi.dsi.fastutil.chars.CharSpliterator |
trySplit() |
characteristics, computeSplitPoint, estimateSize, forEachRemaining, get, makeForSplit, skip, tryAdvanceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected long maxPos
CharBigSpliterators.AbstractIndexBasedSpliterator.pos can be, or -1 if it hasn't been fixed yet.protected LateBindingSizeIndexBasedSpliterator(long initialPos)
protected LateBindingSizeIndexBasedSpliterator(long initialPos,
long fixedMaxPos)
protected abstract long getMaxPosFromBackingStore()
This method will be the return value of getMaxPos() until this spliterator
is trySplit() split, in which case its final return value will be saved
and remain constant for the rest of the duration of this instance.
protected final long getMaxPos()
CharBigSpliterators.AbstractIndexBasedSpliteratorIf pos is equal to the return of this method, this means the last element has been returned and the next call to CharBigSpliterators.AbstractIndexBasedSpliterator.tryAdvance(it.unimi.dsi.fastutil.chars.CharConsumer) 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, CharBigSpliterators.EarlyBindingSizeIndexBasedSpliterator and CharBigSpliterators.LateBindingSizeIndexBasedSpliterator give
an implementation of this method for the two most common strategies.
getMaxPos in class CharBigSpliterators.AbstractIndexBasedSpliteratorpublic it.unimi.dsi.fastutil.chars.CharSpliterator trySplit()
CharBigSpliterators.AbstractIndexBasedSpliteratortrySplit in interface it.unimi.dsi.fastutil.chars.CharSpliteratortrySplit in interface java.util.Spliterator<java.lang.Character>trySplit in interface java.util.Spliterator.OfPrimitive<java.lang.Character,it.unimi.dsi.fastutil.chars.CharConsumer,it.unimi.dsi.fastutil.chars.CharSpliterator>trySplit in class CharBigSpliterators.AbstractIndexBasedSpliterator