de.caff.generics

## Interface CharIndexable

- All Superinterfaces:
    java.lang.Iterable<java.lang.Character>, PrimitiveCharIterable, Sizeable
  All Known Subinterfaces:
    MutableCharIndexable
  All Known Implementing Classes:
    CharIndexable.Base, CharPair, MutableCharIndexable.Base

      public interface CharIndexable
      extends PrimitiveCharIterable, Sizeable

  Class which allows readonly access of raw chars by index.

  The `EMPTY` constant or `emptyIndexable()` method provide the same useful return value to indicate emptiness.

  Since:
    July 7, 2020
  Author:
    Rammi
  See Also:
    `FastCharSequenceSearch`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `CharIndexable.Base` Abstract base class which provides useful implementations for `Object.equals(Object)`, `Object.hashCode()`, `Object.toString()`.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static CharIndexable.Base` | `EMPTY` An empty indexable.

    - ### Fields inherited from interface de.caff.generics.PrimitiveCharIterable

      `EMPTY_CHAR_ITERATOR`

    - ### Fields inherited from interface de.caff.generics.Sizeable

      `NULL`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default void` | `addAllTo(java.util.Collection<? super java.lang.Character> collection)` Add all elements of this indexable to the given collection.
    `default int` | `addToArray(char[] array, int pos)` Add the content of this indexable to the given array.
    `default int` | `addToArray(char[] array, int arrayPos, int index, int length)` Add a part of the content of this indexable to the given array.
    `default int` | `addToArray(int[] array, int pos)` Add the content of this indexable to the given int array.
    `default int` | `addToArray(int[] array, int arrayPos, int index, int length)` Add a part of the content of this indexable to the given intarray.
    `default CharIndexable.Base` | `asBase()` Make this char indexable usable as a class with defined standard Object methods.
    `default java.lang.CharSequence` | `asCharSequence()` Get a view of this char indexable as a char sequence.
    `default java.util.Collection<java.lang.Character>` | `asCollection()` Get a view on this indexable as an unmodifiable collection.
    `default Indexable<java.lang.Character>` | `asIndexable()` Get a view of this indexable as a standard object-based indexable.
    `default IntIndexable.Base` | `asIntIndexable()` View this char indexable as an integer indexable.
    `default java.util.List<java.lang.Character>` | `asList()` Get a view on this indexable as an unmodifiable list.
    `default int` | `binarySearch(char value)` Do a binary search in an indexable ordered in natural ascending order.
    `default int` | `binarySearch(char value, CharOrdering order)` Do a binary search in an ordered indexable.
    `default PrimitiveCharIterator` | `charIterator()` Get an primitive char iterator.
    `default PrimitiveCharIterator` | `charIterator(int from, int to)` Get a char iterator from the given sub set.
    `static int` | `compare(CharIndexable indexable1, CharIndexable indexable2)` Compare two char indexables.
    `static CharIndexable.Base` | `emptyIndexable()` Get an empty indexable set.
    `static boolean` | `equal(CharIndexable indexable1, CharIndexable indexable2)` Are two char indexables equal?
    `static boolean` | `equal(CharIndexable indexable1, java.lang.Object indexable2)` Are two char indexables equal?
    `default int` | `firstMatch(CharPredicate1 check)` Get the first index for which the given check is fulfilled.
    `default char` | `foldLeft(char initialValue, CharOperator2 foldOperation)` Go over all values and do a cumulative calculation.
    `default CharIndexable` | `frozen()` Get a frozen version of this indexable.
    `char` | `get(int index)` Get the element at the given index.
    `default char` | `getMod(int index)` Get an element modulo size.
    `default char` | `gyt(int index)` Pythonesque get.
    `static int` | `hash(CharIndexable indexable)` Calculate a hashcode for a char indexable.
    `default CharIndexable.Base` | `headSet(int toIndex)` Create an indexable subset from the last elements of this indexable set.
    `default java.lang.Iterable<java.lang.Integer>` | `indexes()` Get the indexes of this indexable as an iterable range.
    `static CharIndexable.Base` | `init(int size, char value)` Get a char indexable of a given size which always returns the same value.
    `static CharIndexable` | `initByIndex(int size, IntToCharFunction1 producer)` Get a char indexable of a given size which returns elements created by index.
    `default IntIndexable` | `intIndexes()` Get the indexes of this indexable as an integer indexable.
    `default java.util.PrimitiveIterator.OfInt` | `intIterator()` Get an primitive int iterator.
    `default boolean` | `isEmpty()` Is this indexable empty?
    `default boolean` | `isOrdered()` Is this indexable sorted naturally?
    `default boolean` | `isOrdered(CharOrdering order)` Is this indexable sorted according to the given ordering?
    `default boolean` | `isStrictlyOrdered()` Is this indexable strictly sorted naturally?
    `default boolean` | `isStrictlyOrdered(CharOrdering order)` Is this indexable strictly sorted according to the given ordering?
    `default java.util.Iterator<java.lang.Character>` | `iterator()` Returns an iterator over elements of type `T`.
    `default int` | `lastMatch(CharPredicate1 check)` Get the last index for which the given check is fulfilled.
    `default java.util.ListIterator<java.lang.Character>` | `listIterator()` Returns a list iterator over elements of type `T`.
    `default java.lang.String` | `makeString()` Convert this char indexable into a Java String.
    `default int` | `nextMatch(int startIndex, CharPredicate1 check)` Get the next index for which the given check is fulfilled.
    `default MutableCharIndexable` | `ordered(CharOrdering order)` Create a (mutable) char indexable from the values of this indexable which is ordered as defined by the given ordering.
    `default int` | `previousMatch(int startIndex, CharPredicate1 check)` Get the previous index for which the given check is fulfilled.
    `default CharIndexable.Base` | `reverse()` Get this indexable but with inverted order.
    `default CharIndexable` | `rotated(int steps)` Get a rotated view of this char indexable.
    `static CharIndexable.Base` | `singleton(char value)` View a single char value as a char indexable of size 1.
    `default CharIndexable.Base` | `subSet(int fromIndex, int toIndex)` Get an indexable subset.
    `default CharIndexable.Base` | `sybSet(int fromIndex, int toIndex)` Get an indexable subset.
    `default CharIndexable.Base` | `tailSet(int fromIndex)` Create an indexable subset from the last elements of this indexable set.
    `default char[]` | `toArray()` Convert this indexable into a Java array.
    `default int[]` | `toIntArray()` Convert this indexable into an int array.
    `default java.util.ArrayList<java.lang.Character>` | `toList()` Create a list from this char indexable.
    `static java.lang.String` | `toString(CharIndexable indexable)` Create a string representation of the given indexable.
    `default java.lang.String` | `toText()` Create a string representation of this char indexable.
    `default <T> Indexable<T>` | `view(CharFunction1<? extends T> mapper)` Return a mapped view on this character indexable.
    `static CharIndexable.Base` | `viewArray(char... array)` View an int array as an Indexable.
    `static CharIndexable.Base` | `viewArray(char[] array, int start, int length)` View part of an integer array as an Indexable.
    `static <T> CharIndexable.Base` | `viewArray(T[] array, ToCharFunction<? super T> valueExtract)` View an object array as a char indexable.
    `default BooleanIndexable` | `viewAsBoolean(CharPredicate1 convert)` View this indexable as a boolean indexable while using a conversion for each value.
    `default java.lang.CharSequence` | `viewAsCharSequence()` View this char indexable as a standard Java char sequence.
    `static CharIndexable.Base` | `viewByIndex(int size, IntToCharFunction1 producer)` Get a char indexable of a given size which returns elements created by index.
    `default <T> Indexable<T>` | `viewChars(CharFunction1<? extends T> mapper)` View this char indexable as an indexable of another content.
    `static CharIndexable.Base` | `viewIndexable(Indexable<? extends java.lang.Character> indexable)` View a generic character indexable as char indexable.
    `static CharIndexable.Base` | `viewIndexable(Indexable<? extends java.lang.Character> indexable, char nullFallback)` View a generic character indexable as char indexable.
    `static <T> CharIndexable.Base` | `viewIndexable(Indexable<T> indexable, ToCharFunction<? super T> extractor)` View a generic indexable as a char indexable.
    `static CharIndexable.Base` | `viewList(java.util.List<? extends java.lang.Character> list)` View a list as an Indexable.
    `static CharIndexable.Base` | `viewList(java.util.List<? extends java.lang.Character> list, char nullValue)` View a list as an Indexable.
    `static <T> CharIndexable.Base` | `viewList(java.util.List<T> list, ToCharFunction<? super T> extractor)` View a generic list as a char indexable.
    `default CharIndexable` | `viewOp(CharOperator1 op)` View this char indexable transformed by an operator.
    `static CharIndexable.Base` | `viewString(java.lang.CharSequence text)` View a string as an CharIndexable.
    `default CharIndexable` | `withAppendedValue(char value)` Create a view with of this indexable with another value added at the end.
    `default CharIndexable` | `withExchangedValueAt(int index, char value)` Create a view of this char indexable with an exchanged value.
    `default CharIndexable` | `withInsertedValueAt(int index, char value)` Create a view of this char indexable with an inserted value.
    `default CharIndexable` | `withRemovedValueAt(int index)` Create a view of this indexable with one value removed.
    `default CharIndexable` | `withSwappedValuesAt(int index1, int index2)` Create a view of this char indexable with two values swapped.

    - ### Methods inherited from interface de.caff.generics.PrimitiveCharIterable

      `asIntIterable, asLongIterable, containsChar, forEachChar, forEachCharFragile`

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

      `forEach, spliterator`

    - ### Methods inherited from interface de.caff.generics.Sizeable

      `size`

- - ### Field Detail

    - #### EMPTY

          @NotNull
          static final CharIndexable.Base EMPTY

      An empty indexable.

  - ### Method Detail

    - #### get

          char get(int index)

      Get the element at the given index.
      Parameters:
        `index` - index between `0` and `size() - 1`
      Returns:
        element at the given index

    - #### gyt

          default char gyt(int index)

      Pythonesque get. This allows to access elements from the back by using negative indexes, e.g. `-1` references the last element, `-2` its predecessor, and so on.
      Parameters:
        `index` - index between `-size()` and `size() - 1`
      Returns:
        element at the given index

    - #### getMod

          default char getMod(int index)

      Get an element modulo size.

      This maps the given `index` into the range of this indexable by applying a modulo `Sizeable.size()` operation. For empty indexable this will throw an `IndexOutOfBoundsException` as there is no possible index to get.

      Parameters:
        `index` - index, possibly out of range, possibly even negative for Pythonesque access
      Returns:
        element at the given, possibly modulated, index

    - #### reverse

          @NotNull
          default CharIndexable.Base reverse()

      Get this indexable but with inverted order.
      Returns:
        a view to this indexable which accesses the elements in reverse order

    - #### isEmpty

          default boolean isEmpty()

      Is this indexable empty?
      Returns:
        `true`: there are no elements in this indexable
        `false`: this indexable has elements

    - #### viewChars

          @NotNull
          default <T> Indexable<T> viewChars(@NotNull
                                                      CharFunction1<? extends T> mapper)

      View this char indexable as an indexable of another content.
      Type Parameters:
        `T` - element type of resulting indexable
      Parameters:
        `mapper` - mapper from character to the result element type
      Returns:
        a view which has another element type

    - #### intIterator

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

      Get an primitive int iterator.
      Returns:
        int iterator which iterates over this indexable

    - #### charIterator

          @NotNull
          default PrimitiveCharIterator charIterator()

      Get an primitive char iterator.
      Specified by:
        `charIterator` in interface `PrimitiveCharIterable`
      Returns:
        `char` iterator which iterates over this indexable

    - #### charIterator

          @NotNull
          default PrimitiveCharIterator charIterator(int from,
                                                              int to)

      Get a char iterator from the given sub set.
      Parameters:
        `from` - first index of iterator
        `to` - one past last index of iterator
      Returns:
        int iterator which iterates over the given part of this indexable

    - #### iterator

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

      Returns an iterator over elements of type `T`.
      Specified by:
        `iterator` in interface `java.lang.Iterable<java.lang.Character>`
      Specified by:
        `iterator` in interface `PrimitiveCharIterable`
      Returns:
        an iterator.

    - #### listIterator

          @NotNull
          default java.util.ListIterator<java.lang.Character> listIterator()

      Returns a list iterator over elements of type `T`.
      Returns:
        a read-only list iterator.

    - #### subSet

          @NotNull
          default CharIndexable.Base subSet(int fromIndex,
                                                     int toIndex)

      Get an indexable subset. The subset includes indices `fromIndex` to `toIndex - 1`.
      Parameters:
        `fromIndex` - start index of sub set
        `toIndex` - index after last index
      Returns:
        indxable subset view of this indexable

    - #### sybSet

          @NotNull
          default CharIndexable.Base sybSet(int fromIndex,
                                                     int toIndex)

      Get an indexable subset. This is the Pythonesque version which allows negative indexes.
      Parameters:
        `fromIndex` - start index of sub set
        `toIndex` - end index of sub set
      Returns:
        indexable subset view of this indexable set

    - #### tailSet

          @NotNull
          default CharIndexable.Base tailSet(int fromIndex)

      Create an indexable subset from the last elements of this indexable set. This already allows Pythonesquew indexing.
      Parameters:
        `fromIndex` - index to start with, negative counts from the back
      Returns:
        indexable subset view of this indexable set

    - #### headSet

          @NotNull
          default CharIndexable.Base headSet(int toIndex)

      Create an indexable subset from the last elements of this indexable set. This already allows Pythonesquew indexing.
      Parameters:
        `toIndex` - index one after the end (equal to the length of the returned set), negative counts from the back
      Returns:
        indexable subset view of this indexable set

    - #### view

          @NotNull
          default <T> Indexable<T> view(@NotNull
                                                 CharFunction1<? extends T> mapper)

      Return a mapped view on this character indexable.
      Type Parameters:
        `T` - result type pf mapper
      Parameters:
        `mapper` - mapper
      Returns:
        mapped indexable

    - #### asCollection

          @NotNull
          default java.util.Collection<java.lang.Character> asCollection()

      Get a view on this indexable as an unmodifiable collection. This is especially useful for conversion to standard collection classes, eg for adding all elements via `Collection.addAll(Collection)`.
      Returns:
        collection view

    - #### asList

          @NotNull
          default java.util.List<java.lang.Character> asList()

      Get a view on this indexable as an unmodifiable list. This is especially useful for conversion to standard collection classes, eg for adding all elements via `Collection.addAll(Collection)`.
      Returns:
        collection view
      See Also:
        `toList()`

    - #### toList

          @NotNull
          default java.util.ArrayList<java.lang.Character> toList()

      Create a list from this char indexable. This creates an independent list to which the elements of this indexable are copied.
      Returns:
        list copy of this indexable
      See Also:
        `asList()`

    - #### addAllTo

          default void addAllTo(@NotNull
                                java.util.Collection<? super java.lang.Character> collection)

      Add all elements of this indexable to the given collection.
      Parameters:
        `collection` - collection to add to

    - #### asIndexable

          @NotNull
          default Indexable<java.lang.Character> asIndexable()

      Get a view of this indexable as a standard object-based indexable.
      Returns:
        indexable with non-null `Character` values

    - #### toArray

          @NotNull
          default char[] toArray()

      Convert this indexable into a Java array.
      Returns:
        array copy containing all values of this indexable

    - #### makeString

          @NotNull
          default java.lang.String makeString()

      Convert this char indexable into a Java String. This creates a simple string consisting of the characters, while the standard `toString(CharIndexable)` methods reflects the indexable nature of this object.

      Note that in many cases a `java.lang.CharSequence` can be used instead of a string, see `viewAsCharSequence()` which is cheaper especially for large sequences.

      Returns:
        simple string built from concatenating the characters of this indexable

    - #### viewOp

          @NotNull
          default CharIndexable viewOp(@NotNull
                                                CharOperator1 op)

      View this char indexable transformed by an operator.
      Parameters:
        `op` - transforming operator
      Returns:
        view of this indexable with transformed values

    - #### viewAsCharSequence

          @NotNull
          default java.lang.CharSequence viewAsCharSequence()

      View this char indexable as a standard Java char sequence.
      Returns:
        char sequence view
      See Also:
        `makeString()`

    - #### addToArray

          default int addToArray(@NotNull
                                 char[] array,
                                 int pos)

      Add the content of this indexable to the given array.
      Parameters:
        `array` - array where the content is added
        `pos` - position in the array where the content of this indexable is added
      Returns:
        array position after this indexable

    - #### addToArray

          default int addToArray(@NotNull
                                 char[] array,
                                 int arrayPos,
                                 int index,
                                 int length)

      Add a part of the content of this indexable to the given array.
      Parameters:
        `array` - array where the content is added
        `arrayPos` - position in hte array where the content is added
        `index` - start index of this indexable which is added first
        `length` - number of entries of this indexable added to the array
      Returns:
        array position after the added content

    - #### toIntArray

          @NotNull
          default int[] toIntArray()

      Convert this indexable into an int array.
      Returns:
        array copy containing all values of this indexable

    - #### addToArray

          default int addToArray(@NotNull
                                 int[] array,
                                 int pos)

      Add the content of this indexable to the given int array.
      Parameters:
        `array` - array where the content is added
        `pos` - position in the array where the content of this indexable is added
      Returns:
        array position after this indexable

    - #### addToArray

          default int addToArray(@NotNull
                                 int[] array,
                                 int arrayPos,
                                 int index,
                                 int length)

      Add a part of the content of this indexable to the given intarray.
      Parameters:
        `array` - array where the content is added
        `arrayPos` - position in hte array where the content is added
        `index` - start index of this indexable which is added first
        `length` - number of entries of this indexable added to the array
      Returns:
        array position after the added content

    - #### indexes

          @NotNull
          default java.lang.Iterable<java.lang.Integer> indexes()

      Get the indexes of this indexable as an iterable range.
      Returns:
        iterable indexes
      See Also:
        `intIndexes()`, `Range.indexes(int)`

    - #### intIndexes

          @NotNull
          default IntIndexable intIndexes()

      Get the indexes of this indexable as an integer indexable.
      Returns:
        indexes as integer indexable
      See Also:
        `indexes()`, `IntIndexable.rangeFromSize(int)`

    - #### asIntIndexable

          @NotNull
          default IntIndexable.Base asIntIndexable()

      View this char indexable as an integer indexable.
      Returns:
        integer indexable view

    - #### foldLeft

          default char foldLeft(char initialValue,
                                @NotNull
                                CharOperator2 foldOperation)

      Go over all values and do a cumulative calculation.
      Parameters:
        `initialValue` - start value for the operation, will be returned if this iterable is empty
        `foldOperation` - operation applied to each value, will get the accumulated value as its first and the current element value as its second argument
      Returns:
        accumulated value, result of applying fold operation to all values of this indexable iteratively

    - #### nextMatch

          default int nextMatch(int startIndex,
                                @NotNull
                                CharPredicate1 check)

      Get the next index for which the given check is fulfilled.
      Parameters:
        `startIndex` - start index for checking, `Pythonesque` indexing supported
        `check` - check to perform on elements of this indexable until `true`
      Returns:
        next index starting with `startIndex` for which the check returns `true`, `Pythonesque.UNMAPPABLE` if none

    - #### firstMatch

          default int firstMatch(@NotNull
                                 CharPredicate1 check)

      Get the first index for which the given check is fulfilled.
      Parameters:
        `check` - check to perform on elements of this indexable until `true`
      Returns:
        first index for which the check returns `true`, `-1` if none

    - #### previousMatch

          default int previousMatch(int startIndex,
                                    @NotNull
                                    CharPredicate1 check)

      Get the previous index for which the given check is fulfilled.
      Parameters:
        `startIndex` - start index for checking, `Pythonesque` indexing supported
        `check` - check to perform on elements of this indexable until `true`
      Returns:
        next index starting with `startIndex` for which the check returns `true`, `Pythonesque.UNMAPPABLE` if none

    - #### lastMatch

          default int lastMatch(@NotNull
                                CharPredicate1 check)

      Get the last index for which the given check is fulfilled.
      Parameters:
        `check` - check to perform on elements of this indexable until `true`
      Returns:
        last index for which the check returns `true`, `-1` if none

    - #### frozen

          @NotNull
          default CharIndexable frozen()

      Get a frozen version of this indexable.

      Often Indexables are used as a view to underlying collections. Although this interface is immutable, the underlying colelction might nevertheless change. This copies the current state of this indexable into an unmodifiable state, and returns an Indexable which is stable in size and will return always the same element for a given index. Beware: it is still possible that any element itself changes when the elements are mutable.

      Calling `frozen()` again on the returned object will just return the object itself, so you can safely call this method more than once.

      Returns:
        frozen version of this Indexable

    - #### isOrdered

          default boolean isOrdered(@NotNull
                                    CharOrdering order)

      Is this indexable sorted according to the given ordering? This method tests that consecutive elements in this indexable or either ascending or the same, but never descending. See isStrictlyOrdered(CharOrdering) for a stricter alternative.
      Parameters:
        `order` - expected ordering
      Returns:
        `true` if this indexable is sorted as defined by `order`
        `false` if not

    - #### isOrdered

          default boolean isOrdered()

      Is this indexable sorted naturally? This method tests that consecutive elements in this indexable or either ascending or the same, but never descending.

      See isStrictlyOrdered() for a stricter alternative.

      Returns:
        `true` if this indexable is sorted naturally
        `false` if not

    - #### isStrictlyOrdered

          default boolean isStrictlyOrdered(@NotNull
                                            CharOrdering order)

      Is this indexable strictly sorted according to the given ordering? This method tests that consecutive elements in this indexable or strictly ascending or the same, but never descending. See isOrdered(CharOrdering) for a more relaxed alternative.

      Prefer isOrdered() to check for natural ordering because it is faster.

      Parameters:
        `order` - expected ordering
      Returns:
        `true` if this indexable is sorted as defined by `order`
        `false` if not

    - #### isStrictlyOrdered

          default boolean isStrictlyOrdered()

      Is this indexable strictly sorted naturally? This method tests that consecutive elements in this indexable or strictly ascending or the same, but never descending. See isOrdered() for a more relaxed alternative.
      Returns:
        `true` if this indexable is sorted naturally
        `false` if not

    - #### binarySearch

          default int binarySearch(char value)

      Do a binary search in an indexable ordered in natural ascending order. This requires this indexable to be ordered in `natural ascending order`, i.e. isOrdered(CharOrdering) has to return `true` for this ordering. For efficiency this prerequisite is not checked, but not fulfilling it will make this method return bogus results. If this indexable is only ordered, but not `strictly ordered` it is not defined which index is returned when the looked up value appears in a sequence of equal values.
      Parameters:
        `value` - value to look up
      Returns:
        a positive integer defining the index where the given value was found, and a negative integer if the value is not contained. The latter defines the insertion point where the looked up value would match into this sorted indexable in the form `-(insertIndex + 1)`.

    - #### binarySearch

          default int binarySearch(char value,
                                   @NotNull
                                   CharOrdering order)

      Do a binary search in an ordered indexable. This requires this indexable to be ordered in non-descending order as defined by the given `order`, i.e. isOrdered(CharOrdering) has to return `true` for this order. For efficiency this prerequisite is not checked, but not fulfilling it will make this method return bogus results. If this indexable is only ordered, but not `strictly ordered` it is not defined which index is returned when the looked up value appears in a sequence of equal values.
      Parameters:
        `value` - value to look up
        `order` - sort order
      Returns:
        a positive integer defining the index where the given value was found, and a negative integer if the value is not contained. The latter defines the insertion point where the looked up value would match into this sorted indexable in the form `-(insertIndex + 1)`.

    - #### ordered

          @NotNull
          default MutableCharIndexable ordered(@NotNull
                                                        CharOrdering order)

      Create a (mutable) char indexable from the values of this indexable which is ordered as defined by the given ordering.
      Parameters:
        `order` - sort order
      Returns:
        independent indexable with sorted values

    - #### asBase

          @NotNull
          default CharIndexable.Base asBase()

      Make this char indexable usable as a class with defined standard Object methods.
      Returns:
        based version of this indexable

    - #### withInsertedValueAt

          @NotNull
          default CharIndexable withInsertedValueAt(int index,
                                                             char value)

      Create a view of this char indexable with an inserted value. Note that this is not efficient, but handy in certain situations where only 1 or a few values are inserted. Use `ExpandableIntIndexable` if you want to carry out more stuff like this.

      As this creates a view of this indexable, changes to this indexable might result in a disaster when using the returned indexable!

      Parameters:
        `index` - index where the value is inserted before the current index (not Pythonesque, because it is possible to add an value at `index == size()`, and it is expected that most insertion will happen at 0 or at the end)
        `value` - inserted value at that index
      Returns:
        a view of this indexable with 1 more value at the given index, all values beyond are moved one index forward
      See Also:
        `withAppendedValue(char)`

    - #### withAppendedValue

          @NotNull
          default CharIndexable withAppendedValue(char value)

      Create a view with of this indexable with another value added at the end. Note that this is not efficient, but handy in certain situations where only 1 or a few items are added.
      Parameters:
        `value` - value to add
      Returns:
        indexable view of this indexable, with the given value added at the end, so size is larger by 1
      See Also:
        `withInsertedValueAt(int, char)`

    - #### withExchangedValueAt

          @NotNull
          default CharIndexable withExchangedValueAt(int index,
                                                              char value)

      Create a view of this char indexable with an exchanged value. Note that this is not efficient, but handy in certain situations where only 1 or a few values are exchanged. Use `ExpandableIntIndexable` if you want to carry out more stuff like this.

      As this creates a view of this indexable, changes to this indexable could lead to unexpected results when using the returned indexable!

      Parameters:
        `index` - index where the element is exchanged, hiding the current element. (Pythonesque)
        `value` - exchanged value at that index
      Returns:
        a view of this indexable with 1 more element at the given index, all elements beyond are moved one index forward

    - #### withRemovedValueAt

          @NotNull
          default CharIndexable withRemovedValueAt(int index)

      Create a view of this indexable with one value removed. Note that this is not efficient, but handy in certain situations where only one or a few values are removed.
      Parameters:
        `index` - index of the removed value (Pythonesque)
      Returns:
        a view of this indexable where the value at the given index is removed

    - #### withSwappedValuesAt

          @NotNull
          default CharIndexable withSwappedValuesAt(int index1,
                                                             int index2)

      Create a view of this char indexable with two values swapped. Note that this is not efficient, but handy in certain situations where only a few items are swapped.
      Parameters:
        `index1` - index of the first value (Pythonesque)
        `index2` - index of the second value (Pythonesque)
      Returns:
        a view of this indexable where the first and second value have exchanged places

    - #### rotated

          @NotNull
          default CharIndexable rotated(int steps)

      Get a rotated view of this char indexable. The returned indexable will show this indexable with rotated indexes. A positive `steps` will rotate left, i.e. any index will be accessed as if the number of steps is added before extraction (modulo length). E.g. a rotation of `-1` will return the last element when index `0` is requested, and the first element for index `1`.
      Parameters:
        `steps` - steps to rotate
      Returns:
        rotated view of this indexable, use `frozen()` to create an indexable which no longer depends on this one

    - #### viewAsBoolean

          @NotNull
          default BooleanIndexable viewAsBoolean(@NotNull
                                                          CharPredicate1 convert)

      View this indexable as a boolean indexable while using a conversion for each value.

      Use `frozen()` on the result to decouple it from this indexable.

      Parameters:
        `convert` - converter applied to each value of this indexable before it is returned from the resulting indexable
      Returns:
        boolean indexable view of this indexable

    - #### toText

          @NotNull
          default java.lang.String toText()

      Create a string representation of this char indexable. Compared to `()` this method will always work, `toString()` will only do what is expected when the implementation extends `CharIndexable.Base` (which takes care of `toString()` or provides the expected implementation itself.

      Use `asCharSequence()` to create a non-copy view of this char indexable, and use `subSet(int, int)`, `headSet(int)`, or `tailSet(int)` first to create texts from parts of this indexable.

      Returns:
        a string created from the characters in this char indexable
      See Also:
        `asCharSequence()`

    - #### asCharSequence

          @NotNull
          default java.lang.CharSequence asCharSequence()

      Get a view of this char indexable as a char sequence.

      The main advantage over `Object.toString()` is that this method will always work even if the implementation of this interface is neither extending `CharIndexable.Base` nor takes care of creating a string itself, and that this method does not copy the chars around which can be preferable for large sizes.

      Returns:
        char sequence view, i.e. any changes to this char indexable will be reflected in the view. Use `frozen()` for an immutable char indexable first if this might create a problem.
      See Also:
        `toText()`

    - #### viewList

          @NotNull
          static CharIndexable.Base viewList(@NotNull
                                                      java.util.List<? extends java.lang.Character> list)

      View a list as an Indexable. This requires a list of non-null numbers as a base.
      Parameters:
        `list` - list used as a base, required to have only non-null elements
      Returns:
        indexable view of the given list, so any changes of the list will be reflected by the returned Indexable

    - #### viewList

          @NotNull
          static CharIndexable.Base viewList(@NotNull
                                                      java.util.List<? extends java.lang.Character> list,
                                                      char nullValue)

      View a list as an Indexable. This allows to provide a fallback for null elements in the list.
      Parameters:
        `list` - list used as a base, required to have only non-null elements
        `nullValue` - value returned for `null` elements in the list
      Returns:
        indexable view of the given list, so any changes of the list will be reflected by the returned Indexable

    - #### viewList

          @NotNull
          static <T> CharIndexable.Base viewList(@NotNull
                                                          java.util.List<T> list,
                                                          @NotNull
                                                          ToCharFunction<? super T> extractor)

      View a generic list as a char indexable.
      Type Parameters:
        `T` - element type of list
      Parameters:
        `list` - generic list
        `extractor` - extractor function which extracts a char from the elements of `list`
      Returns:
        a char indexable view of `list`

    - #### viewIndexable

          @NotNull
          static CharIndexable.Base viewIndexable(@NotNull
                                                           Indexable<? extends java.lang.Character> indexable)

      View a generic character indexable as char indexable.
      Parameters:
        `indexable` - generic indexable with Character elements, required to have only non-null elements
      Returns:
        char indexable view

    - #### viewIndexable

          @NotNull
          static CharIndexable.Base viewIndexable(@NotNull
                                                           Indexable<? extends java.lang.Character> indexable,
                                                           char nullFallback)

      View a generic character indexable as char indexable.
      Parameters:
        `indexable` - generic indexable with Character elements
        `nullFallback` - fallback for `null` elements
      Returns:
        char indexable view

    - #### viewIndexable

          @NotNull
          static <T> CharIndexable.Base viewIndexable(@NotNull
                                                               Indexable<T> indexable,
                                                               @NotNull
                                                               ToCharFunction<? super T> extractor)

      View a generic indexable as a char indexable.
      Type Parameters:
        `T` - element type of indexable
      Parameters:
        `indexable` - generic indexable
        `extractor` - extractor function which extracts a char from the elements of `indexable`
      Returns:
        a char indexable view of `indexable`

    - #### viewString

          @NotNull
          static CharIndexable.Base viewString(@NotNull
                                                        java.lang.CharSequence text)

      View a string as an CharIndexable.
      Parameters:
        `text` - text string
      Returns:
        indexable view of the given text string

    - #### viewArray

          @NotNull
          static CharIndexable.Base viewArray(@NotNull
                                                       char... array)

      View an int array as an Indexable. To view only part of the array use `viewArray(char[], int, int)`.
      Parameters:
        `array` - array used as base
      Returns:
        indexable view of the given array, any changes to the underlying array will be reflected by the returned Indexable

    - #### viewArray

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

      View part of an integer array as an Indexable.
      Parameters:
        `array` - array used as base
        `start` - index of first byte to use from the array
        `length` - number of elements to use from the array
      Returns:
        indexable view of the given array, any changes to the underlying array will be reflected by the returned Indexable

    - #### viewArray

          @NotNull
          static <T> CharIndexable.Base viewArray(@NotNull
                                                           T[] array,
                                                           @NotNull
                                                           ToCharFunction<? super T> valueExtract)

      View an object array as a char indexable.
      Type Parameters:
        `T` - array element type
      Parameters:
        `array` - viewed array
        `valueExtract` - converter from array elements to the char values of this indexable
      Returns:
        indexable view of the given array, any changes to the underlying array will be reflected by the returned Indexable

    - #### singleton

          @NotNull
          static CharIndexable.Base singleton(char value)

      View a single char value as a char indexable of size 1.
      Parameters:
        `value` - single value
      Returns:
        indexable with one value

    - #### init

          @NotNull
          static CharIndexable.Base init(int size,
                                                  char value)

      Get a char indexable of a given size which always returns the same value.
      Parameters:
        `size` - size of the returned indexable
        `value` - value returned for each element
      Returns:
        indexable of size `size` with always the same element

    - #### viewByIndex

          @NotNull
          static CharIndexable.Base viewByIndex(int size,
                                                         @NotNull
                                                         IntToCharFunction1 producer)

      Get a char indexable of a given size which returns elements created by index. This will always call the `producer` when an element is requested. Use `frozen()` on the result to create an indexable which avoids this.
      Parameters:
        `size` - size of the returned indexable
        `producer` - producer which is called with an index and expected to return the associated value
      Returns:
        an indexable with the given size which will return elements by calling the `producer`

    - #### initByIndex

          @NotNull
          static CharIndexable initByIndex(int size,
                                                    @NotNull
                                                    IntToCharFunction1 producer)

      Get a char indexable of a given size which returns elements created by index. This will call the producer only once for each element during the call of this method, and return the results on later requests.
      Parameters:
        `size` - size of the returned indexable
        `producer` - producer which is called with an index and expected to return the associated value
      Returns:
        indexable with elements initialized by the `producer`
      See Also:
        `viewByIndex(int, IntToCharFunction1)`

    - #### emptyIndexable

          @NotNull
          static CharIndexable.Base emptyIndexable()

      Get an empty indexable set.
      Returns:
        empty indexable

    - #### toString

          @NotNull
          static java.lang.String toString(@NotNull
                                                    CharIndexable indexable)

      Create a string representation of the given indexable.
      Parameters:
        `indexable` - indexable
      Returns:
        string representation
      See Also:
        `makeString()`

    - #### hash

          static int hash(@NotNull
                          CharIndexable indexable)

      Calculate a hashcode for a char indexable.
      Parameters:
        `indexable` - indexable for which the hash code is required
      Returns:
        hash code for the given indexable

    - #### equal

          static boolean equal(@NotNull
                               CharIndexable indexable1,
                               @NotNull
                               CharIndexable indexable2)

      Are two char indexables equal?
      Parameters:
        `indexable1` - first indexable
        `indexable2` - second indexable
      Returns:
        `true` if both indexables contain the same values in the same sequence
        `false` if sizes or values differ

    - #### equal

          static boolean equal(@NotNull
                               CharIndexable indexable1,
                               @Nullable
                               java.lang.Object indexable2)

      Are two char indexables equal? This is a convenience method which may be called from implementations for their `Object.equals(Object)` method.
      Parameters:
        `indexable1` - first indexable
        `indexable2` - object expected to be an indexable itself
      Returns:
        `true` if both indexables contain the same values in the same sequence
        `false` if the second object is not an indexable, of if sizes or values differ

    - #### compare

          static int compare(@NotNull
                             CharIndexable indexable1,
                             @NotNull
                             CharIndexable indexable2)

      Compare two char indexables. This compares the two indexable lexically element by element until either the first difference is found (smaller of the two values define the lower indexable) or the end of one is met (shorter indexable is less).
      Parameters:
        `indexable1` - first indexable
        `indexable2` - second indexable
      Returns:
        `< 0>` if `indexable1 < indxable2`, `0` if `indexable1 == indexable2`, or `> 0` if `indexable1 > indexable2`