de.caff.generics

## Class IndexableHelper

- java.lang.Object
- - de.caff.generics.IndexableHelper

-     class IndexableHelper
      extends java.lang.Object

  Helper class for indexables. This class provides methods used for indexables.
  Since:
    Dezember 10, 2021
  Author:
    Rammi

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) static BooleanIndexable.Base` | `frozenFromArray(boolean[] array)` Get a boolean indexable view of an array which is frozen.
    `(package private) static BooleanIndexable.Base` | `frozenFromArray(boolean[] array, int start, int length)` Get a boolean indexable view of a part of an array which is frozen.
    `(package private) static ByteIndexable.Base` | `frozenFromArray(byte[] array)` Get a byte indexable view of an array which is frozen.
    `(package private) static ByteIndexable.Base` | `frozenFromArray(byte[] array, int start, int length)` Get a byte indexable view of a part of an array which is frozen.
    `(package private) static CharIndexable.Base` | `frozenFromArray(char[] array)` Get a char indexable view of an array which is frozen.
    `(package private) static CharIndexable.Base` | `frozenFromArray(char[] array, int start, int length)` Get a char indexable view of a part of an array which is frozen.
    `(package private) static DoubleIndexable.Base` | `frozenFromArray(double[] array)` Get a double indexable view of an array which is frozen.
    `(package private) static DoubleIndexable.Base` | `frozenFromArray(double[] array, int start, int length)` Get a double indexable view of a part of an array which is frozen.
    `(package private) static FloatIndexable.Base` | `frozenFromArray(float[] array)` Get a float indexable view of an array which is frozen.
    `(package private) static FloatIndexable.Base` | `frozenFromArray(float[] array, int start, int length)` Get a float indexable view of a part of an array which is frozen.
    `(package private) static IntIndexable.Base` | `frozenFromArray(int[] array)` Get an int indexable view of an array which is frozen.
    `(package private) static IntIndexable.Base` | `frozenFromArray(int[] array, int start, int length)` Get an int indexable view of a part of an array which is frozen.
    `(package private) static LongIndexable.Base` | `frozenFromArray(long[] array)` Get a long indexable view of an array which is frozen.
    `(package private) static LongIndexable.Base` | `frozenFromArray(long[] array, int start, int length)` Get a long indexable view of a part of an array which is frozen.
    `(package private) static ShortIndexable.Base` | `frozenFromArray(short[] array)` Get a short indexable view of an array which is frozen.
    `(package private) static ShortIndexable.Base` | `frozenFromArray(short[] array, int start, int length)` Get a short indexable view of a part of an array which is frozen.
    `(package private) static <T> Indexable.Base<T>` | `frozenFromArray(T[] array)`
    `(package private) static <T> Indexable.Base<T>` | `frozenFromList(java.util.List<T> list)` Create a frozen indexable from a list.
    `(package private) static <T> Indexable.Base<T>` | `frozenFromList(java.util.List<T> list, java.util.function.Function<? super T,? extends T> elementCloner)` Create a frozen indexable from a list while keeping possibly mutable elements safe.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### frozenFromList

          @NotNull
          static <T> Indexable.Base<T> frozenFromList(@NotNull
                                                               java.util.List<T> list)

      Create a frozen indexable from a list. This assumes that the list will never be changed.
      Type Parameters:
        `T` - element type of indexable/list
      Parameters:
        `list` - list to be wrapped by an indexable
      Returns:
        indexable based on list, which will return itself on frozen and will include further optimizations for an unmodified list

    - #### frozenFromList

          @NotNull
          static <T> Indexable.Base<T> frozenFromList(@NotNull
                                                               java.util.List<T> list,
                                                               @NotNull
                                                               java.util.function.Function<? super T,? extends T> elementCloner)

      Create a frozen indexable from a list while keeping possibly mutable elements safe. This assumes that the list will never be changed. It also takes care of mutable elements by copying them on each request, so the elements in the returned indexable will never change.
      Type Parameters:
        `T` - element type of indexable/list
      Parameters:
        `list` - list to be wrapped by an indexable
        `elementCloner` - function called for each requested element which returns a copy it
      Returns:
        indexable based on list, which will return itself on frozen and will include further optimizations for an unmodified list

    - #### frozenFromArray

          @NotNull
          static <T> Indexable.Base<T> frozenFromArray(@NotNull
                                                                T[] array)

    - #### frozenFromArray

          @NotNull
          static DoubleIndexable.Base frozenFromArray(@NotNull
                                                               double[] array)

      Get a double indexable view of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
      Returns:
        frozen double indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static DoubleIndexable.Base frozenFromArray(@NotNull
                                                               double[] array,
                                                               int start,
                                                               int length)

      Get a double indexable view of a part of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
        `start` - start index into array
        `length` - number of values to be used from array
      Returns:
        frozen double indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static FloatIndexable.Base frozenFromArray(@NotNull
                                                              float[] array)

      Get a float indexable view of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
      Returns:
        frozen float indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static FloatIndexable.Base frozenFromArray(@NotNull
                                                              float[] array,
                                                              int start,
                                                              int length)

      Get a float indexable view of a part of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
        `start` - start index into array
        `length` - number of values to be used from array
      Returns:
        frozen float indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static LongIndexable.Base frozenFromArray(@NotNull
                                                             long[] array)

      Get a long indexable view of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
      Returns:
        frozen long indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static LongIndexable.Base frozenFromArray(@NotNull
                                                             long[] array,
                                                             int start,
                                                             int length)

      Get a long indexable view of a part of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
        `start` - start index into array
        `length` - number of values to be used from array
      Returns:
        frozen long indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static IntIndexable.Base frozenFromArray(@NotNull
                                                            int[] array)

      Get an int indexable view of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
      Returns:
        frozen int indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static IntIndexable.Base frozenFromArray(@NotNull
                                                            int[] array,
                                                            int start,
                                                            int length)

      Get an int indexable view of a part of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
        `start` - start index into array
        `length` - number of values to be used from array
      Returns:
        frozen int indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static ShortIndexable.Base frozenFromArray(@NotNull
                                                              short[] array)

      Get a short indexable view of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
      Returns:
        frozen short indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static ShortIndexable.Base frozenFromArray(@NotNull
                                                              short[] array,
                                                              int start,
                                                              int length)

      Get a short indexable view of a part of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
        `start` - start index into array
        `length` - number of values to be used from array
      Returns:
        frozen short indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static ByteIndexable.Base frozenFromArray(@NotNull
                                                             byte[] array)

      Get a byte indexable view of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
      Returns:
        frozen byte indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static ByteIndexable.Base frozenFromArray(@NotNull
                                                             byte[] array,
                                                             int start,
                                                             int length)

      Get a byte indexable view of a part of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
        `start` - start index into array
        `length` - number of values to be used from array
      Returns:
        frozen byte indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static CharIndexable.Base frozenFromArray(@NotNull
                                                             char[] array)

      Get a char indexable view of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
      Returns:
        frozen char indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static CharIndexable.Base frozenFromArray(@NotNull
                                                             char[] array,
                                                             int start,
                                                             int length)

      Get a char indexable view of a part of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
        `start` - start index into array
        `length` - number of values to be used from array
      Returns:
        frozen char indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static BooleanIndexable.Base frozenFromArray(@NotNull
                                                                boolean[] array)

      Get a boolean indexable view of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
      Returns:
        frozen boolean indexable view of the given `array`

    - #### frozenFromArray

          @NotNull
          static BooleanIndexable.Base frozenFromArray(@NotNull
                                                                boolean[] array,
                                                                int start,
                                                                int length)

      Get a boolean indexable view of a part of an array which is frozen.
      Parameters:
        `array` - array not expected to be changed
        `start` - start index into array
        `length` - number of values to be used from array
      Returns:
        frozen boolean indexable view of the given `array`