public static final class Spliterators.OfInt
extends java.lang.Object
Spliterator.OfInt
Modifier and Type | Method and Description |
---|---|
static void |
forEachRemaining(Spliterator.OfInt this_,
Consumer<? super java.lang.Integer> action)
Performs the given action for each remaining element, sequentially in
the current thread, until all elements have been processed or the action
throws an exception.
|
static void |
forEachRemaining(Spliterator.OfInt this_,
IntConsumer action)
Performs the given action for each remaining element of the passed Spliterator,
sequentially in the current thread, until all elements have been processed or
the action throws an exception.
|
static boolean |
tryAdvance(Spliterator.OfInt this_,
Consumer<? super java.lang.Integer> action)
If a remaining element exists, performs the given action on it,
returning
true ; else returns false . |
public static void forEachRemaining(Spliterator.OfInt this_, IntConsumer action)
this_
Spliterator is Spliterator.ORDERED
,
actions are performed in encounter order. Exceptions thrown by the
action are relayed to the caller.
Implementation Requirements:
The default implementation repeatedly invokes tryAdvance(java8.util.Spliterator.OfInt, java8.util.function.Consumer<? super java.lang.Integer>)
until it returns false
. It should be overridden whenever
possible.
this_
- the Spliterator whose remaining elements should be processedaction
- The action to executejava.lang.NullPointerException
- if the specified this_
Spliterator is nulljava.lang.NullPointerException
- if the specified action is nullpublic static boolean tryAdvance(Spliterator.OfInt this_, Consumer<? super java.lang.Integer> action)
true
; else returns false
. If the this_
Spliterator is Spliterator.ORDERED
the action is performed on the
next element in encounter order. Exceptions thrown by the
action are relayed to the caller.
Implementation Requirements:
If the action is an instance of IntConsumer
then it is cast
to IntConsumer
and passed to
Spliterator.OfInt.tryAdvance(java8.util.function.IntConsumer)
; otherwise
the action is adapted to an instance of IntConsumer
, by
boxing the argument of IntConsumer
, and then passed to
Spliterator.OfInt.tryAdvance(java8.util.function.IntConsumer)
.
this_
- the Spliterator to useaction
- The action to executefalse
if no remaining elements existed
upon entry to this method, else true
.java.lang.NullPointerException
- if the specified this_
Spliterator is nulljava.lang.NullPointerException
- if the specified action is nullpublic static void forEachRemaining(Spliterator.OfInt this_, Consumer<? super java.lang.Integer> action)
this_
Spliterator is Spliterator.ORDERED
, actions
are performed in encounter order. Exceptions thrown by the action
are relayed to the caller.
Implementation Requirements:
If the action is an instance of IntConsumer
then it is cast
to IntConsumer
and passed to
Spliterator.OfInt.forEachRemaining(java8.util.function.IntConsumer)
; otherwise
the action is adapted to an instance of IntConsumer
, by
boxing the argument of IntConsumer
, and then passed to
Spliterator.OfInt.forEachRemaining(java8.util.function.IntConsumer)
.
this_
- the Spliterator to useaction
- The action to executejava.lang.NullPointerException
- if the specified this_
Spliterator is nulljava.lang.NullPointerException
- if the specified action is null