public interface PrimitiveBooleanIterator extends java.util.PrimitiveIterator<java.lang.Boolean,BooleanConsumer>
boolean
values.
This is missing in the standard library: an iterator
for raw boolean
values which does everything what
OfInt
does for
[@code int}s.
Modifier and Type | Field and Description |
---|---|
static PrimitiveBooleanIterator |
EMPTY
Empty iterator of primitive boolean values.
|
Modifier and Type | Method and Description |
---|---|
default void |
forEachRemaining(BooleanConsumer action)
Performs the given action for each remaining element until all elements
have been processed or the action throws an exception.
|
default void |
forEachRemaining(java.util.function.Consumer<? super java.lang.Boolean> action)
If the action is an instance of
BooleanConsumer then it is cast
to BooleanConsumer and passed to forEachRemaining(de.caff.generics.function.BooleanConsumer) ;
otherwise the action is adapted to an instance of
BooleanConsumer , by boxing the argument of BooleanConsumer ,
and then passed to forEachRemaining(de.caff.generics.function.BooleanConsumer) . |
default java.lang.Boolean |
next()
The default implementation boxes the result of calling
nextBool() , and returns that boxed result. |
boolean |
nextBool()
Returns the next
boolean element in the iteration. |
static final PrimitiveBooleanIterator EMPTY
boolean nextBool()
boolean
element in the iteration.boolean
element in the iterationjava.util.NoSuchElementException
- if the iteration has no more elementsdefault void forEachRemaining(@NotNull BooleanConsumer action)
The default implementation behaves as if:
while (hasNext())
action.accept(nextBoolean());
forEachRemaining
in interface java.util.PrimitiveIterator<java.lang.Boolean,BooleanConsumer>
action
- The action to be performed for each elementjava.lang.NullPointerException
- if the specified action is nulldefault java.lang.Boolean next()
nextBool()
, and returns that boxed result.next
in interface java.util.Iterator<java.lang.Boolean>
default void forEachRemaining(@NotNull java.util.function.Consumer<? super java.lang.Boolean> action)
BooleanConsumer
then it is cast
to BooleanConsumer
and passed to forEachRemaining(de.caff.generics.function.BooleanConsumer)
;
otherwise the action is adapted to an instance of
BooleanConsumer
, by boxing the argument of BooleanConsumer
,
and then passed to forEachRemaining(de.caff.generics.function.BooleanConsumer)
.forEachRemaining
in interface java.util.Iterator<java.lang.Boolean>