de.caff.generics

## Interface PrimitiveDoubleIterable

- All Superinterfaces:
    java.lang.Iterable<java.lang.Double>
  All Known Subinterfaces:
    DoubleIndexable, ExpandableDoubleIndexable, MutableDoubleIndexable
  All Known Implementing Classes:
    DoubleIndexable.Base, DoublePair, MutableDoubleIndexable.Base

      public interface PrimitiveDoubleIterable
      extends java.lang.Iterable<java.lang.Double>

  Iterable which iterates over a primitive double.
  Since:
    December 13, 2021
  Author:
    Rammi

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static PrimitiveDoubleIterable` | `EMPTY` Empty iterable of primitive double values.
    `static java.util.PrimitiveIterator.OfDouble` | `EMPTY_DOUBLE_ITERATOR` Empty iterator of primitive double values.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default java.util.OptionalDouble` | `average()` Calculate the average of all elements in this iterable.
    `default boolean` | `containsDouble(double value)` Does this double iterable contain the given value?
    `default boolean` | `containsDouble(double value, double eps)` Does this float iterable contain the given value?
    `java.util.PrimitiveIterator.OfDouble` | `doubleIterator()` Get a primitive double iterator.
    `default void` | `forEachDouble(java.util.function.DoubleConsumer action)` Invoke the given action with each double value in this iterable.
    `default <E extends java.lang.Exception> void` | `forEachDoubleFragile(FragileDoubleConsumer<E> action)` Invoke the given fragile action with each value in this iterable.
    `default java.util.Iterator<java.lang.Double>` | `iterator()`
    `default java.util.Spliterator.OfDouble` | `spliterator()`
    `default java.util.stream.DoubleStream` | `stream()` Get a stream of primitive long values from this iterable.
    `default double` | `sum()` Calculate the sum of the elements of this iterable.

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

- - ### Field Detail

    - #### EMPTY_DOUBLE_ITERATOR

          static final java.util.PrimitiveIterator.OfDouble EMPTY_DOUBLE_ITERATOR

      Empty iterator of primitive double values.

    - #### EMPTY

          static final PrimitiveDoubleIterable EMPTY

      Empty iterable of primitive double values.

  - ### Method Detail

    - #### doubleIterator

          @NotNull
          java.util.PrimitiveIterator.OfDouble doubleIterator()

      Get a primitive double iterator.
      Returns:
        double iterator

    - #### iterator

          @NotNull
          default java.util.Iterator<java.lang.Double> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<java.lang.Double>`

    - #### forEachDouble

          default void forEachDouble(@NotNull
                                     java.util.function.DoubleConsumer action)

      Invoke the given action with each double value in this iterable.
      Parameters:
        `action` - action to be call for each double value in sequemce.

    - #### forEachDoubleFragile

          default <E extends java.lang.Exception> void forEachDoubleFragile(@NotNull
                                                                            FragileDoubleConsumer<E> action)
                                                                     throws E extends java.lang.Exception

      Invoke the given fragile action with each value in this iterable.
      Type Parameters:
        `E` - checked exception thrown by action
      Parameters:
        `action` - action to be called for each value in sequence
      Throws:
        `E` - if `action` throws it
        `E extends java.lang.Exception`

    - #### containsDouble

          default boolean containsDouble(double value)

      Does this double iterable contain the given value? This is an operation which is linear to the size of this iterable and should only be used rarely.
      Parameters:
        `value` - value to check for
      Returns:
        `true` if the value is contained in this iterable, `false` if not

    - #### containsDouble

          default boolean containsDouble(double value,
                                         double eps)

      Does this float iterable contain the given value? Compared to `containsDouble(double)` this allows for a small deviation.
      Parameters:
        `value` - value to check for
        `eps` - epsilon defining the possible deviation from `value` which is still accepted
      Returns:
        `true` if this indexable contains the value within the given epsilon, `false` if not

    - #### sum

          default double sum()

      Calculate the sum of the elements of this iterable.
      Returns:
        sum of all elements of this iterable

    - #### average

          @NotNull
          default java.util.OptionalDouble average()

      Calculate the average of all elements in this iterable.
      Returns:
        average

    - #### spliterator

          default java.util.Spliterator.OfDouble spliterator()

      Specified by:
        `spliterator` in interface `java.lang.Iterable<java.lang.Double>`

    - #### stream

          @NotNull
          default java.util.stream.DoubleStream stream()

      Get a stream of primitive long values from this iterable.
      Returns:
        `double` stream