de.caff.generics

## Interface BooleanIndexable

- All Superinterfaces:
    java.lang.Iterable<java.lang.Boolean>, PrimitiveBooleanIterable, Sizeable
  All Known Subinterfaces:
    MutableBooleanIndexable
  All Known Implementing Classes:
    BooleanIndexable.Base, BooleanPair, MutableBooleanIndexable.Base

      public interface BooleanIndexable
      extends PrimitiveBooleanIterable, Sizeable

  Class which allows readonly access of raw booleans by index.

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

  Simple implementations should extend `BooleanIndexable.Base` because that provides useful implementations for standard Object methods and implements `Comparable`.

  Since:
    July 7, 2020
  Author:
    Rammi

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `BooleanIndexable.Base` Abstract base class which provides useful implementations for `Object.equals(Object)`, `Object.hashCode()`, `Object.toString()`.
    `static interface` | `BooleanIndexable.EntryConsumer` Consumer for index-value pairs with `int` values.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static BooleanIndexable.Base` | `EMPTY` An empty indexable.
    `static BooleanIndexable` | `SINGLE_FALSE` Boolean indexable with a single `false` value.
    `static BooleanIndexable` | `SINGLE_TRUE` Boolean indexable with a single `false` value.

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

      `EMPTY_BOOLEAN_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.Boolean> collection)` Add all elements of this indexable to the given collection.
    `default int` | `addToArray(boolean[] array, int pos)` Add the content of this indexable to the given array.
    `default int` | `addToArray(boolean[] array, int arrayPos, int index, int length)` Add a part of the content of this indexable to the given array.
    `default BooleanIndexable.Base` | `asBase()` Make this boolean indexable usable as a class with defined standard Object methods.
    `default java.util.Collection<java.lang.Boolean>` | `asCollection()` Get a view on this indexable as an unmodifiable collection.
    `default Indexable<java.lang.Boolean>` | `asIndexable()` Get a view of this indexable as a standard object-based indexable.
    `default java.util.List<java.lang.Boolean>` | `asList()` Get a view on this indexable as an unmodifiable list.
    `default PrimitiveBooleanIterator` | `booleanIterator()` Get an primitive boolean iterator.
    `default PrimitiveBooleanIterator` | `booleanIterator(int from, int to)` Get a boolean iterator from the given sub set.
    `static int` | `compare(BooleanIndexable indexable1, BooleanIndexable indexable2)` Compare two boolean indexables.
    `static BooleanIndexable.Base` | `emptyIndexable()` Get an empty indexable set.
    `static boolean` | `equal(BooleanIndexable indexable1, BooleanIndexable indexable2)` Are two boolean indexables equal?
    `static boolean` | `equal(BooleanIndexable indexable1, java.lang.Object indexable2)` Are two boolean indexables equal?
    `default int` | `firstMatch(BooleanPredicate1 check)` Get the first index for which the given check is fulfilled.
    `default boolean` | `foldLeft(boolean initialValue, BooleanOperator2 foldOperation)` Go over all values and do a cumulative calculation.
    `default void` | `forEachBoolEntry(BooleanIndexable.EntryConsumer consumer)` Call an entry consumer foreach entry in this indexable.
    `default BooleanIndexable` | `frozen()` Get a frozen version of this indexable.
    `boolean` | `get(int index)` Get the element at the given index.
    `default boolean` | `getMod(int index)` Get an element modulo size.
    `default boolean` | `gyt(int index)` Pythonesque get.
    `static int` | `hash(BooleanIndexable indexable)` Calculate a hashcode for a boolean indexable.
    `default BooleanIndexable.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 BooleanIndexable.Base` | `init(int size, boolean value)` Get a boolean indexable of a given size which always returns the same value.
    `static BooleanIndexable` | `initByIndex(int size, IntPredicate1 producer)` Get a boolean 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 boolean` | `isEmpty()` Is this indexable empty?
    `default java.util.Iterator<java.lang.Boolean>` | `iterator()` Returns an iterator over elements of type `T`.
    `default int` | `lastMatch(BooleanPredicate1 check)` Get the last index for which the given check is fulfilled.
    `default java.util.ListIterator<java.lang.Boolean>` | `listIterator()` Returns a list iterator over elements of type `T`.
    `default int` | `nextMatch(int startIndex, BooleanPredicate1 check)` Get the next index for which the given check is fulfilled.
    `default int` | `previousMatch(int startIndex, BooleanPredicate1 check)` Get the previous index for which the given check is fulfilled.
    `default BooleanIndexable.Base` | `reverse()` Get this indexable but with inverted order.
    `default BooleanIndexable` | `rotated(int steps)` Get a rotated view of this boolean indexable.
    `static BooleanIndexable.Base` | `singleton(boolean value)` View a single boolean value as a boolean indexable of size 1.
    `default BooleanIndexable.Base` | `subSet(int fromIndex, int toIndex)` Get an indexable subset.
    `default BooleanIndexable.Base` | `sybSet(int fromIndex, int toIndex)` Get an indexable subset.
    `default BooleanIndexable.Base` | `tailSet(int fromIndex)` Create an indexable subset from the last elements of this indexable set.
    `default boolean[]` | `toArray()` Convert this indexable into a Java array.
    `default java.util.ArrayList<java.lang.Boolean>` | `toList()` Create a list from this boolean indexable.
    `static java.lang.String` | `toString(BooleanIndexable indexable)` Create a string representation of the given indexable.
    `default <T> Indexable<T>` | `view(BooleanFunction1<? extends T> mapper)` Return a mapped view on this boolean indexable.
    `static BooleanIndexable.Base` | `viewArray(boolean... array)` View an int array as an Indexable.
    `static BooleanIndexable.Base` | `viewArray(boolean[] array, int start, int length)` View part of an integer array as an Indexable.
    `static <T> BooleanIndexable.Base` | `viewArray(T[] array, java.util.function.Predicate<? super T> valueExtract)` View an object array as a boolean indexable.
    `static BooleanIndexable.Base` | `viewByIndex(int size, IntPredicate1 producer)` Get a boolean indexable of a given size which returns elements created by index.
    `static BooleanIndexable.Base` | `viewIndexable(Indexable<? extends java.lang.Boolean> indexable)` View a generic Number indexable as integer indexable.
    `static BooleanIndexable.Base` | `viewIndexable(Indexable<? extends java.lang.Boolean> indexable, boolean nullFallback)` View a generic Number indexable as integer indexable.
    `static <T> BooleanIndexable.Base` | `viewIndexable(Indexable<T> indexable, java.util.function.Predicate<? super T> extractor)` View a generic indexable as a boolean indexable.
    `static BooleanIndexable.Base` | `viewList(java.util.List<? extends java.lang.Boolean> list)` View a list as an Indexable.
    `static BooleanIndexable.Base` | `viewList(java.util.List<? extends java.lang.Boolean> list, boolean nullFallback)` View a list as an Indexable.
    `static <T> BooleanIndexable.Base` | `viewList(java.util.List<T> list, java.util.function.Predicate<? super T> extractor)` View a generic list as a boolean indexable.
    `default BooleanIndexable` | `withAppendedValue(boolean value)` Create a view with of this indexable with another value added at the end.
    `static BooleanIndexable.Base` | `withCachedHash(BooleanIndexable indexable)` Wrap an indexable with one which caches the hash value.
    `default BooleanIndexable` | `withExchangedValueAt(int index, boolean value)` Create a view of this boolean indexable with an exchanged value.
    `default BooleanIndexable` | `withInsertedValueAt(int index, boolean value)` Create a view of this boolean indexable with an inserted value.
    `default BooleanIndexable` | `withRemovedValueAt(int index)` Create a view of this indexable with one value removed.
    `default BooleanIndexable` | `withSwappedValuesAt(int index1, int index2)` Create a view of this boolean indexable with two values swapped.

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

      `and, containsBool, containsFalse, containsTrue, forEachBool, forEachBooleanFragile, forEachBoolFragile, or, xor`

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

      `forEach, spliterator`

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

      `size`

- - ### Field Detail

    - #### SINGLE_FALSE

          static final BooleanIndexable SINGLE_FALSE

      Boolean indexable with a single `false` value.

    - #### SINGLE_TRUE

          static final BooleanIndexable SINGLE_TRUE

      Boolean indexable with a single `false` value.

    - #### EMPTY

          @NotNull
          static final BooleanIndexable.Base EMPTY

      An empty indexable.

  - ### Method Detail

    - #### get

          boolean 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 boolean gyt(int index)

      Pythonesque get. This allows accessing 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 boolean 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 BooleanIndexable.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

    - #### booleanIterator

          @NotNull
          default PrimitiveBooleanIterator booleanIterator()

      Get an primitive boolean iterator.
      Specified by:
        `booleanIterator` in interface `PrimitiveBooleanIterable`
      Returns:
        `boolean` iterator which iterates over this indexable

    - #### booleanIterator

          @NotNull
          default PrimitiveBooleanIterator booleanIterator(int from,
                                                                    int to)

      Get a boolean 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.Boolean> iterator()

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

    - #### listIterator

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

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

    - #### subSet

          @NotNull
          default BooleanIndexable.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 BooleanIndexable.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 BooleanIndexable.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 BooleanIndexable.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
                                                 BooleanFunction1<? extends T> mapper)

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

    - #### asCollection

          @NotNull
          default java.util.Collection<java.lang.Boolean> 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.Boolean> 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.Boolean> toList()

      Create a list from this boolean 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.Boolean> collection)

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

    - #### asIndexable

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

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

    - #### toArray

          @NotNull
          default boolean[] toArray()

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

    - #### addToArray

          default int addToArray(@NotNull
                                 boolean[] 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
                                 boolean[] 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

    - #### 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)`

    - #### foldLeft

          default boolean foldLeft(boolean initialValue,
                                   @NotNull
                                   BooleanOperator2 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

    - #### withInsertedValueAt

          @NotNull
          default BooleanIndexable withInsertedValueAt(int index,
                                                                boolean value)

      Create a view of this boolean 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.

      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(boolean)`

    - #### withAppendedValue

          @NotNull
          default BooleanIndexable withAppendedValue(boolean 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, boolean)`

    - #### withExchangedValueAt

          @NotNull
          default BooleanIndexable withExchangedValueAt(int index,
                                                                 boolean value)

      Create a view of this boolean 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.

      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 BooleanIndexable 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 BooleanIndexable withSwappedValuesAt(int index1,
                                                                int index2)

      Create a view of this boolean 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 BooleanIndexable rotated(int steps)

      Get a rotated view of this boolean 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

    - #### viewList

          @NotNull
          static BooleanIndexable.Base viewList(@NotNull
                                                         java.util.List<? extends java.lang.Boolean> 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 BooleanIndexable.Base viewList(@NotNull
                                                         java.util.List<? extends java.lang.Boolean> list,
                                                         boolean nullFallback)

      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
        `nullFallback` - 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> BooleanIndexable.Base viewList(@NotNull
                                                             java.util.List<T> list,
                                                             @NotNull
                                                             java.util.function.Predicate<? super T> extractor)

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

    - #### viewIndexable

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

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

    - #### viewIndexable

          @NotNull
          static BooleanIndexable.Base viewIndexable(@NotNull
                                                              Indexable<? extends java.lang.Boolean> indexable,
                                                              boolean nullFallback)

      View a generic Number indexable as integer indexable.
      Parameters:
        `indexable` - generic indexable with Number elements
        `nullFallback` - fallback for `null` elements
      Returns:
        integer indexable view

    - #### viewIndexable

          @NotNull
          static <T> BooleanIndexable.Base viewIndexable(@NotNull
                                                                  Indexable<T> indexable,
                                                                  @NotNull
                                                                  java.util.function.Predicate<? super T> extractor)

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

    - #### viewArray

          @NotNull
          static BooleanIndexable.Base viewArray(@NotNull
                                                          boolean... array)

      View an int array as an Indexable. To view only part of the array use `viewArray(boolean[], 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 BooleanIndexable.Base viewArray(@NotNull
                                                          boolean[] array,
                                                          int start,
                                                          int length)

      View part of an integer array as an Indexable.
      Parameters:
        `array` - array used as base
        `start` - start index into the array
        `length` - number of booleans 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> BooleanIndexable.Base viewArray(@NotNull
                                                              T[] array,
                                                              @NotNull
                                                              java.util.function.Predicate<? super T> valueExtract)

      View an object array as a boolean indexable.
      Type Parameters:
        `T` - array element type
      Parameters:
        `array` - viewed array
        `valueExtract` - converter from array elements to the boolean 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 BooleanIndexable.Base singleton(boolean value)

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

    - #### init

          @NotNull
          static BooleanIndexable.Base init(int size,
                                                     boolean value)

      Get a boolean 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 BooleanIndexable.Base viewByIndex(int size,
                                                            @NotNull
                                                            IntPredicate1 producer)

      Get a boolean 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`
      See Also:
        `initByIndex(int, IntPredicate1)`

    - #### initByIndex

          @NotNull
          static BooleanIndexable initByIndex(int size,
                                                       @NotNull
                                                       IntPredicate1 producer)

      Get a boolean 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, IntPredicate1)`

    - #### emptyIndexable

          @NotNull
          static BooleanIndexable.Base emptyIndexable()

      Get an empty indexable set.
      Returns:
        empty indexable

    - #### toString

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

      Create a string representation of the given indexable.
      Parameters:
        `indexable` - indexable
      Returns:
        string representation

    - #### equal

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

      Are two boolean 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
                               BooleanIndexable indexable1,
                               @Nullable
                               java.lang.Object indexable2)

      Are two boolean 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
                             BooleanIndexable indexable1,
                             @NotNull
                             BooleanIndexable indexable2)

      Compare two boolean 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`

    - #### hash

          static int hash(@NotNull
                          BooleanIndexable indexable)

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

    - #### withCachedHash

          @NotNull
          static BooleanIndexable.Base withCachedHash(@NotNull
                                                               BooleanIndexable indexable)

      Wrap an indexable with one which caches the hash value. This is useful if indexables are used as hash keys because hash value calculation is expensive.

      The wrapped indexable must not change after it is wrapped, otherwise strange things are expected to happen.

      Parameters:
        `indexable` - wrapped indexable, must not change
      Returns:
        indexable which forwards most methods to `indexable`, but also provides useful implementations for `Object.hashCode()`, `Object.equals(Object)`, and `Object.toString()`

    - #### nextMatch

          default int nextMatch(int startIndex,
                                @NotNull
                                BooleanPredicate1 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
                                 BooleanPredicate1 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
                                    BooleanPredicate1 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
                                BooleanPredicate1 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 BooleanIndexable 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

    - #### forEachBoolEntry

          default void forEachBoolEntry(@NotNull
                                        BooleanIndexable.EntryConsumer consumer)

      Call an entry consumer foreach entry in this indexable.
      Parameters:
        `consumer` - consumer to be called

    - #### asBase

          @NotNull
          default BooleanIndexable.Base asBase()

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