de.caff.generics

## Interface PrimitiveShortIterator

- All Superinterfaces:
    java.util.Iterator<java.lang.Short>, java.util.PrimitiveIterator<java.lang.Short,ShortConsumer>

      public interface PrimitiveShortIterator
      extends java.util.PrimitiveIterator<java.lang.Short,ShortConsumer>

  An iterator specialized for `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.

  Since:
    September 27, 2020
  Author:
    Rammi

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface java.util.PrimitiveIterator

      `java.util.PrimitiveIterator.OfDouble, java.util.PrimitiveIterator.OfInt, java.util.PrimitiveIterator.OfLong`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static PrimitiveShortIterator` | `EMPTY` Empty iterator of primitive short values.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    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.

    - ### Methods inherited from interface java.util.Iterator

      `hasNext, remove`

- - ### Field Detail

    - #### EMPTY

          static final PrimitiveShortIterator EMPTY

      Empty iterator of primitive short values.

  - ### Method Detail

    - #### nextShort

          short nextShort()

      Returns the next `short` element in the iteration.
      Returns:
        the next `short` element in the iteration
      Throws:
        `java.util.NoSuchElementException` - if the iteration has no more elements

    - #### forEachRemaining

          default void forEachRemaining(@NotNull
                                        ShortConsumer action)

      Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.

      The default implementation behaves as if:

               while (hasNext())
                   action.accept(nextShort());

      Specified by:
        `forEachRemaining` in interface `java.util.PrimitiveIterator<java.lang.Short,ShortConsumer>`
      Parameters:
        `action` - The action to be performed for each element
      Throws:
        `java.lang.NullPointerException` - if the specified action is null

    - #### next

          default java.lang.Short next()

      The default implementation boxes the result of calling `nextShort()`, and returns that boxed result.
      Specified by:
        `next` in interface `java.util.Iterator<java.lang.Short>`

    - #### forEachRemaining

          default void forEachRemaining(@NotNull
                                        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)`.
      Specified by:
        `forEachRemaining` in interface `java.util.Iterator<java.lang.Short>`

    - #### asIntIterator

          @NotNull
          default java.util.PrimitiveIterator.OfInt asIntIterator()

      View this short iterator as an int iterator. Please note that you should use either this iterator of the returned one, but don't mix using both.
      Returns:
        int iterator view of this iterator

    - #### asUnsignedIntIterator

          @NotNull
          default java.util.PrimitiveIterator.OfInt asUnsignedIntIterator()

      View this short iterator as an int iterator using the values of this iterator as unsigned shorts. Please note that you should use either this iterator of the returned one, but don't mix using both.
      Returns:
        int iterator view of this iterator

    - #### asLongIterator

          @NotNull
          default java.util.PrimitiveIterator.OfLong asLongIterator()

      View this short iterator as a long iterator. Please note that you should use either this iterator of the returned one, but don't mix using both.
      Returns:
        long iterator view of this iterator

    - #### asUnsignedLongIterator

          @NotNull
          default java.util.PrimitiveIterator.OfLong asUnsignedLongIterator()

      View this byte iterator as a long iterator using the values of this iterator as unsigned bytes. Please note that you should use either this iterator of the returned one, but don't mix using both.
      Returns:
        long iterator view of this iterator