public class MappingStepper<A,B> extends java.lang.Object implements Stepper<B>
Stepper.OfDoubleSpliterator, Stepper.OfIntSpliterator, Stepper.OfLongSpliterator, Stepper.OfSpliterator<A>, Stepper.UnboxingByteStepper, Stepper.UnboxingCharStepper, Stepper.UnboxingDoubleStepper, Stepper.UnboxingFloatStepper, Stepper.UnboxingIntStepper, Stepper.UnboxingLongStepper, Stepper.UnboxingShortStepper
Constructor and Description |
---|
MappingStepper(Stepper<A> underlying,
scala.Function1<A,B> mapping) |
Modifier and Type | Method and Description |
---|---|
int |
characteristics()
Characteristics are bit flags that indicate runtime characteristics of this Stepper.
|
void |
foreach(scala.Function1<B,scala.runtime.BoxedUnit> f)
Applies
f to every remaining element in the collection. |
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.
|
B |
nextStep()
The next element traversed by this Stepper.
|
java.util.Spliterator<B> |
spliterator()
Returns this
Stepper as a java.util.Spliterator . |
Stepper<B> |
substep()
Attempt to split this
Stepper in half, with the new (returned) copy taking the first half
of the collection, and this one advancing to cover the second half. |
boolean |
tryStep(scala.Function1<B,scala.runtime.BoxedUnit> f)
If another element exists, apply `f` to it and return `true`; otherwise, return `false`.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accumulate
public int characteristics()
StepperLike
- Distinct
means that no duplicates exist
- Immutable
means that the underlying collection is guaranteed not to change during traversal
- NonNull
means that no nulls will be returned during traversal
- Sized
means that the collection knows its exact size
- SubSized
means that sub-Steppers created with substep()
will also know their own size. SubSized
steppers must also be Sized
.
The Java flags CONCURRENT
and SORTED
are not supported; modification of a concurrency-aware underlying collection is not
guaranteed to be any safer than modification of any generic mutable collection, and if the underlying collection is ordered by
virtue of sorting, Stepper
will not keep track of that fact.
characteristics
in interface StepperLike<B,Stepper<B>>
public void foreach(scala.Function1<B,scala.runtime.BoxedUnit> f)
StepperLike
f
to every remaining element in the collection.
This is a terminal operation.foreach
in interface StepperLike<B,Stepper<B>>
f
- (undocumented)public boolean hasStep()
StepperLike
hasStep
in interface StepperLike<B,Stepper<B>>
public long knownSize()
StepperLike
knownSize
in interface StepperLike<B,Stepper<B>>
public B 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<B,Stepper<B>>
public java.util.Spliterator<B> spliterator()
StepperLike
Stepper
as a java.util.Spliterator
.
This is a terminal operation.spliterator
in interface StepperLike<B,Stepper<B>>
public Stepper<B> substep()
StepperLike
Stepper
in half, with the new (returned) copy taking the first half
of the collection, and this one advancing to cover the second half. If subdivision is not
possible or not advisable, substep()
will return null
.substep
in interface StepperLike<B,Stepper<B>>
public boolean tryStep(scala.Function1<B,scala.runtime.BoxedUnit> f)
StepperLike
tryStep
in interface StepperLike<B,Stepper<B>>