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