de.caff.generics.function

## Interface IntOrdering

- All Superinterfaces:
    ByteOrdering, CharOrdering, ShortOrdering
  All Known Subinterfaces:
    IntOrdering.Serial
  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 IntOrdering
      extends ByteOrdering, ShortOrdering, CharOrdering

  Define an order for two primitive int values.

  Compared to a `Comparator<Integer>` this can avoid boxing and unboxing in various situations.

  Since:
    January 23, 2023
  Author:
    Rammi

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `IntOrdering.Serial` An int ordering which is serializable.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static IntOrdering` | `ASCENDING` Natural order of ascending `int` values.
    `static IntOrdering` | `DESCENDING` Inverse natural order of `int` values.
    `static IntOrdering` | `UNSIGNED_ASCENDING` Natural order of ascending unsigned `int` values.
    `static IntOrdering` | `UNSIGNED_DESCENDING` Natural order of ascending unsigned `int` values.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default boolean` | `ascending(int v1, int v2)` Are the two values represented in strictly ascending order?
    `default boolean` | `ascendingOrSame(int v1, int v2)` Are the two values represented in ascending order?
    `default java.util.Comparator<java.lang.Integer>` | `asIntComparator()` Use this ordering as a comparator.
    `default Ordering<java.lang.Integer>` | `asIntOrdering()` Get this ordering as a generic int ordering.
    `default java.util.Comparator<java.lang.Number>` | `asNumberComparator()` View this ordering as a number comparator.
    `default Order` | `checkByte(byte v1, byte v2)` Get the order of the two values.
    `default Order` | `checkChar(char v1, char v2)` Get the order of the two values.
    `Order` | `checkInt(int v1, int v2)` Get the order of the two values.
    `default Order` | `checkShort(short v1, short v2)` Get the order of the two values.
    `default boolean` | `descending(int v1, int v2)` Are the two values represented in strictly descending order?
    `default boolean` | `descendingOrSame(int v1, int v2)` Are the two values represented in descending order?
    `default boolean` | `different(int v1, int v2)` Are the two values considered different by this order?
    `static IntOrdering` | `fromComparator(java.util.Comparator<java.lang.Integer> comparator)` Convert a standard comparator of `Double` into a double ordering.
    `default IntOrdering` | `inverse()` Invert this order.
    `default boolean` | `same(int v1, int v2)` Are the two values considered equal by this order?

    - ### Methods inherited from interface de.caff.generics.function.ByteOrdering

      `asByteComparator, asByteOrdering, ascending, ascendingOrSame, descending, descendingOrSame, different, fromComparator, same`

    - ### Methods inherited from interface de.caff.generics.function.ShortOrdering

      `ascending, ascendingOrSame, asShortComparator, asShortOrdering, descending, descendingOrSame, different, fromComparator, same`

    - ### Methods inherited from interface de.caff.generics.function.CharOrdering

      `ascending, ascendingOrSame, asCharComparator, asCharOrdering, descending, descendingOrSame, different, fromComparator, same`

- - ### Field Detail

    - #### ASCENDING

          static final IntOrdering ASCENDING

      Natural order of ascending `int` values.

    - #### DESCENDING

          static final IntOrdering DESCENDING

      Inverse natural order of `int` values.

    - #### UNSIGNED_ASCENDING

          static final IntOrdering UNSIGNED_ASCENDING

      Natural order of ascending unsigned `int` values. This handles int values as if they are unsigned and not signed.

    - #### UNSIGNED_DESCENDING

          static final IntOrdering UNSIGNED_DESCENDING

      Natural order of ascending unsigned `int` values. This handles int values as if they are unsigned and not signed.

  - ### Method Detail

    - #### checkInt

          @NotNull
          Order checkInt(int v1,
                                  int v2)

      Get the order of the two values.
      Parameters:
        `v1` - first value
        `v2` - second value
      Returns:
        order of the two values

    - #### checkByte

          @NotNull
          default Order checkByte(byte v1,
                                           byte v2)

      Description copied from interface: `ByteOrdering`
      Get the order of the two values.
      Specified by:
        `checkByte` in interface `ByteOrdering`
      Parameters:
        `v1` - first value
        `v2` - second value
      Returns:
        order of the two values

    - #### checkChar

          @NotNull
          default Order checkChar(char v1,
                                           char v2)

      Description copied from interface: `CharOrdering`
      Get the order of the two values.
      Specified by:
        `checkChar` in interface `CharOrdering`
      Parameters:
        `v1` - first value
        `v2` - second value
      Returns:
        order of the two values

    - #### checkShort

          @NotNull
          default Order checkShort(short v1,
                                            short v2)

      Description copied from interface: `ShortOrdering`
      Get the order of the two values.
      Specified by:
        `checkShort` in interface `ShortOrdering`
      Parameters:
        `v1` - first value
        `v2` - second value
      Returns:
        order of the two values

    - #### ascending

          default boolean ascending(int v1,
                                    int v2)

      Are the two values represented in strictly ascending order?
      Parameters:
        `v1` - first value
        `v2` - second value
      Returns:
        `true` if `v1 < v2` according to this ordering
        `false` if `v1 >= v2` according to this ordering
      See Also:
        `descending(int, int)`, `ascendingOrSame(int, int)`, `descendingOrSame(int, int)`, `same(int, int)`, `different(int, int)`

    - #### ascendingOrSame

          default boolean ascendingOrSame(int v1,
                                          int v2)

      Are the two values represented in ascending order?
      Parameters:
        `v1` - first value
        `v2` - second value
      Returns:
        `true` if `v1 <= v2` according to this ordering
        `false` if `v1 > v2` according to this ordering
      See Also:
        `ascending(int, int)`, `descending(int, int)`, `descendingOrSame(int, int)`, `same(int, int)`, `different(int, int)`

    - #### descending

          default boolean descending(int v1,
                                     int v2)

      Are the two values represented in strictly descending order?
      Parameters:
        `v1` - first value
        `v2` - second value
      Returns:
        `true` if `v1 > v2` according to this ordering
        `false` if `v1 <= v2` according to this ordering
      See Also:
        `ascending(int, int)`, `ascendingOrSame(int, int)`, `descendingOrSame(int, int)`, `same(int, int)`, `different(int, int)`

    - #### descendingOrSame

          default boolean descendingOrSame(int v1,
                                           int v2)

      Are the two values represented in descending order?
      Parameters:
        `v1` - first value
        `v2` - second value
      Returns:
        `true` if `v1 >= v2` according to this ordering
        `false` if `v1 < v2` according to this ordering
      See Also:
        `ascending(int, int)`, `descending(int, int)`, `ascendingOrSame(int, int)`, `same(int, int)`, `different(int, int)`

    - #### same

          default boolean same(int v1,
                               int v2)

      Are the two values considered equal by this order?
      Parameters:
        `v1` - first value
        `v2` - second value
      Returns:
        `true` if `v1 == v2` according to this order
        `false` if `v1 != v2` according to this ordering
      See Also:
        `ascending(int, int)`, `descending(int, int)`, `ascendingOrSame(int, int)`, `descendingOrSame(int, int)`, `different(int, int)`

    - #### different

          default boolean different(int v1,
                                    int v2)

      Are the two values considered different by this order?
      Parameters:
        `v1` - first value
        `v2` - second value
      Returns:
        `true` if `v1 != v2` according to this order
        `false` if `v1 == v2` according to this ordering
      See Also:
        `ascending(int, int)`, `descending(int, int)`, `ascendingOrSame(int, int)`, `descendingOrSame(int, int)`, `same(int, int)`

    - #### inverse

          @NotNull
          default IntOrdering inverse()

      Invert this order.
      Specified by:
        `inverse` in interface `ByteOrdering`
      Specified by:
        `inverse` in interface `CharOrdering`
      Specified by:
        `inverse` in interface `ShortOrdering`
      Returns:
        inverse order

    - #### asIntComparator

          @NotNull
          default java.util.Comparator<java.lang.Integer> asIntComparator()

      Use this ordering as a comparator.
      Returns:
        comparator of `Int`

    - #### asNumberComparator

          @NotNull
          default java.util.Comparator<java.lang.Number> asNumberComparator()

      View this ordering as a number comparator.
      Specified by:
        `asNumberComparator` in interface `ByteOrdering`
      Specified by:
        `asNumberComparator` in interface `ShortOrdering`
      Returns:
        comparator of `Number`

    - #### asIntOrdering

          @NotNull
          default Ordering<java.lang.Integer> asIntOrdering()

      Get this ordering as a generic int ordering.
      Returns:
        generic ordering for ints

    - #### fromComparator

          @NotNull
          static IntOrdering fromComparator(@NotNull
                                                     java.util.Comparator<java.lang.Integer> comparator)

      Convert a standard comparator of `Double` into a double ordering.
      Parameters:
        `comparator` - comparator of `Double`
      Returns:
        ordering