public interface TryStepper<A> extends Stepper<A>, StepperLike<A,TryStepper<A>>
Stepper will implement hasNext and nextStep by caching applications of tryStep.
Subclasses must implement tryUncached instead of tryStep, and should leave it protected, and must implement
knownUncachedSize instead of knownSize. For speed, foreachUncached may also be overridden. It is recommended
that all of the Uncached methods be left protected.Stepper.UnboxingByteStepper, Stepper.UnboxingCharStepper, Stepper.UnboxingDoubleStepper, Stepper.UnboxingFloatStepper, Stepper.UnboxingIntStepper, Stepper.UnboxingLongStepper, Stepper.UnboxingShortStepper| Modifier and Type | Method and Description |
|---|---|
void |
foreach(scala.Function1<A,scala.runtime.BoxedUnit> f)
Applies
f to every remaining element in the collection. |
void |
foreachUncached(scala.Function1<A,scala.runtime.BoxedUnit> f) |
boolean |
hasStep()
`true` if there are more elements to step through, `false` if not.
|
long |
knownSize()
Returns the size of the collection, if known exactly, or `-1` if not.
|
long |
knownUncachedSize() |
boolean |
load() |
A |
myCache() |
boolean |
myCacheIsFull() |
A |
nextStep()
The next element traversed by this Stepper.
|
java.util.Spliterator<A> |
spliterator()
Returns this
Stepper as a java.util.Spliterator. |
boolean |
tryStep(scala.Function1<A,scala.runtime.BoxedUnit> f)
If another element exists, apply `f` to it and return `true`; otherwise, return `false`.
|
boolean |
tryUncached(scala.Function1<A,scala.runtime.BoxedUnit> f) |
accumulateanticipateParallelism, characteristics, count, count, exists, find, fold, foldTo, iterator, reduce, substep, tovoid foreach(scala.Function1<A,scala.runtime.BoxedUnit> f)
StepperLikef to every remaining element in the collection.
This is a terminal operation.foreach in interface StepperLike<A,TryStepper<A>>f - (undocumented)void foreachUncached(scala.Function1<A,scala.runtime.BoxedUnit> f)
boolean hasStep()
StepperLikehasStep in interface StepperLike<A,TryStepper<A>>long knownSize()
StepperLikeknownSize in interface StepperLike<A,TryStepper<A>>long knownUncachedSize()
boolean load()
A myCache()
boolean myCacheIsFull()
A nextStep()
StepperLikenextStep() throws an exception if no elements exist, so check hasStep immediately prior
to calling. Note that tryStep also consumes an element, so the result of hasStep will
be invalid after tryStep is called.nextStep in interface StepperLike<A,TryStepper<A>>java.util.Spliterator<A> spliterator()
StepperLikeStepper as a java.util.Spliterator.
This is a terminal operation.spliterator in interface StepperLike<A,TryStepper<A>>boolean tryStep(scala.Function1<A,scala.runtime.BoxedUnit> f)
StepperLiketryStep in interface StepperLike<A,TryStepper<A>>boolean tryUncached(scala.Function1<A,scala.runtime.BoxedUnit> f)