public interface PrimitiveCharIterator extends java.util.PrimitiveIterator<java.lang.Character,CharConsumer>
cahr
values.
This is missing in the standard library: an iterator
for raw char
values which does everything what
OfInt
does for
[@code int}s.
Modifier and Type | Field and Description |
---|---|
static PrimitiveCharIterator |
EMPTY
Empty iterator of primitive char values.
|
Modifier and Type | Method and Description |
---|---|
default java.util.PrimitiveIterator.OfInt |
asIntIterator()
View this char iterator as an int iterator.
|
default java.util.PrimitiveIterator.OfLong |
asLongIterator()
View this char iterator as a long iterator.
|
default void |
forEachRemaining(CharConsumer 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.Character> action)
If the action is an instance of
CharConsumer then it is cast
to CharConsumer and passed to forEachRemaining(de.caff.generics.function.CharConsumer) ;
otherwise the action is adapted to an instance of
CharConsumer , by boxing the argument of CharConsumer ,
and then passed to forEachRemaining(de.caff.generics.function.CharConsumer) . |
default java.lang.Character |
next()
The default implementation boxes the result of calling
nextChar() , and returns that boxed result. |
char |
nextChar()
Returns the next
char element in the iteration. |
static final PrimitiveCharIterator EMPTY
char nextChar()
char
element in the iteration.char
element in the iterationjava.util.NoSuchElementException
- if the iteration has no more elementsdefault void forEachRemaining(@NotNull CharConsumer action)
The default implementation behaves as if:
while (hasNext())
action.accept(nextChar());
forEachRemaining
in interface java.util.PrimitiveIterator<java.lang.Character,CharConsumer>
action
- The action to be performed for each elementjava.lang.NullPointerException
- if the specified action is nulldefault java.lang.Character next()
nextChar()
, and returns that boxed result.next
in interface java.util.Iterator<java.lang.Character>
default void forEachRemaining(@NotNull java.util.function.Consumer<? super java.lang.Character> action)
CharConsumer
then it is cast
to CharConsumer
and passed to forEachRemaining(de.caff.generics.function.CharConsumer)
;
otherwise the action is adapted to an instance of
CharConsumer
, by boxing the argument of CharConsumer
,
and then passed to forEachRemaining(de.caff.generics.function.CharConsumer)
.forEachRemaining
in interface java.util.Iterator<java.lang.Character>
@NotNull default java.util.PrimitiveIterator.OfInt asIntIterator()
@NotNull default java.util.PrimitiveIterator.OfLong asLongIterator()