de.caff.generics

## Interface PrimitiveByteIterator

- All Superinterfaces:
    java.util.Iterator<java.lang.Byte>, java.util.PrimitiveIterator<java.lang.Byte,ByteConsumer>

      public interface PrimitiveByteIterator
      extends java.util.PrimitiveIterator<java.lang.Byte,ByteConsumer>

  An iterator specialized for `short` values.

  This is missing in the standard library: an iterator for raw `byte` values which does everything what `OfInt` does for `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 PrimitiveByteIterator` | `EMPTY` Empty iterator of primitive byte 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 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.

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

      `hasNext, remove`

- - ### Field Detail

    - #### EMPTY

          static final PrimitiveByteIterator EMPTY

      Empty iterator of primitive byte values.

  - ### Method Detail

    - #### nextByte

          byte nextByte()

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

    - #### forEachRemaining

          default void forEachRemaining(@NotNull
                                        ByteConsumer 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(nextByte());

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

    - #### next

          default java.lang.Byte next()

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

    - #### forEachRemaining

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

    - #### asShortIterator

          @NotNull
          default PrimitiveShortIterator asShortIterator()

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

    - #### asIntIterator

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

      View this byte 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 byte iterator as an int 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:
        int iterator view of this iterator

    - #### asLongIterator

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

      View this byte 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