de.caff.generics

## Interface TwoWayChoice<T>

- Type Parameters:
    `T` - value type
  Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

      @FunctionalInterface
      public interface TwoWayChoice<T>

  A choice between two values. One value is associated with `true`, the other with `false`. This is basically the functional equivalent of the ternary operator with the restriction that both values have to be `null`. See `TwoWayChoiceN` with does not have this restriction.

  The recommended way to create a two-way choice is `of(Object, Object)`.

  Since:
    December 27, 2022
  Author:
    Rammi

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `choose(boolean select)` Return the selected choice.
    `static <V> TwoWayChoice<V>` | `of(V trueValue, V falseValue)` Create a two-way choice.

- - ### Method Detail

    - #### choose

          @NotNull
          T choose(boolean select)

      Return the selected choice.
      Parameters:
        `select` - selector
      Returns:
        selected choice

    - #### of

          @NotNull
          static <V> TwoWayChoice<V> of(@NotNull
                                                 V trueValue,
                                                 @NotNull
                                                 V falseValue)

      Create a two-way choice.
      Type Parameters:
        `V` - value type of selection
      Parameters:
        `trueValue` - value returned for `true` selector, required to be not `null`
        `falseValue` - value returned for `false` selector, required to be not `null`
      Returns:
        boolean choice which performs the same as `select ? trueValue : falseValue`