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.OfDoubleSpliterator, Stepper.OfIntSpliterator, Stepper.OfLongSpliterator, Stepper.OfSpliterator<A>, 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) |
accumulate
anticipateParallelism, characteristics, count, count, exists, find, fold, foldTo, iterator, reduce, substep, to
A myCache()
boolean myCacheIsFull()
boolean load()
boolean hasStep()
StepperLike
hasStep
in interface StepperLike<A,TryStepper<A>>
A nextStep()
StepperLike
nextStep()
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>>
long knownSize()
StepperLike
knownSize
in interface StepperLike<A,TryStepper<A>>
long knownUncachedSize()
boolean tryStep(scala.Function1<A,scala.runtime.BoxedUnit> f)
StepperLike
tryStep
in interface StepperLike<A,TryStepper<A>>
boolean tryUncached(scala.Function1<A,scala.runtime.BoxedUnit> f)
void foreach(scala.Function1<A,scala.runtime.BoxedUnit> f)
StepperLike
f
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)
java.util.Spliterator<A> spliterator()
StepperLike
Stepper
as a java.util.Spliterator
.
This is a terminal operation.spliterator
in interface StepperLike<A,TryStepper<A>>