de.caff.generics.function

## Interface ShortOrdering

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

  Define an order for two primitive short values.

  Compared to a `Comparator<Short>` 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` | `ShortOrdering.Serial` A short ordering which is serializable.

  - ### Field Summary

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

  - ### Method Summary

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

- - ### Field Detail

    - #### ASCENDING

          static final ShortOrdering ASCENDING

      Natural order of ascending `short` values.

    - #### DESCENDING

          static final ShortOrdering DESCENDING

      Inverse natural order of `short` values.

    - #### UNSIGNED_ASCENDING

          static final ShortOrdering UNSIGNED_ASCENDING

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

    - #### UNSIGNED_DESCENDING

          static final ShortOrdering UNSIGNED_DESCENDING

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

  - ### Method Detail

    - #### checkShort

          @NotNull
          Order checkShort(short v1,
                                    short v2)

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

    - #### ascending

          default boolean ascending(short v1,
                                    short 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(short, short)`, `ascendingOrSame(short, short)`, `descendingOrSame(short, short)`, `same(short, short)`, `different(short, short)`

    - #### ascendingOrSame

          default boolean ascendingOrSame(short v1,
                                          short 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(short, short)`, `descending(short, short)`, `descendingOrSame(short, short)`, `same(short, short)`, `different(short, short)`

    - #### descending

          default boolean descending(short v1,
                                     short 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(short, short)`, `ascendingOrSame(short, short)`, `descendingOrSame(short, short)`, `same(short, short)`, `different(short, short)`

    - #### descendingOrSame

          default boolean descendingOrSame(short v1,
                                           short 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(short, short)`, `descending(short, short)`, `ascendingOrSame(short, short)`, `same(short, short)`, `different(short, short)`

    - #### same

          default boolean same(short v1,
                               short 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(short, short)`, `descending(short, short)`, `ascendingOrSame(short, short)`, `descendingOrSame(short, short)`, `different(short, short)`

    - #### different

          default boolean different(short v1,
                                    short 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(short, short)`, `descending(short, short)`, `ascendingOrSame(short, short)`, `descendingOrSame(short, short)`, `same(short, short)`

    - #### inverse

          @NotNull
          default ShortOrdering inverse()

      Invert this order.
      Returns:
        inverse order

    - #### asShortComparator

          @NotNull
          default java.util.Comparator<java.lang.Short> asShortComparator()

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

    - #### asNumberComparator

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

      View this ordering as a number comparator.
      Returns:
        comparator of `Number`

    - #### asShortOrdering

          @NotNull
          default Ordering<java.lang.Short> asShortOrdering()

      Get this ordering as a generic short ordering.
      Returns:
        generic ordering for shorts

    - #### fromComparator

          @NotNull
          static ShortOrdering fromComparator(@NotNull
                                                       java.util.Comparator<java.lang.Short> comparator)

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