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