de.caff.generics.algorithm

## Class FastSortChar

- java.lang.Object
- - de.caff.generics.algorithm.FastSortChar

-     public class FastSortChar
      extends java.lang.Object

  A sort algorithm for byte arrays which is much faster compared to TimSort. This algorithm is making advantage that there are just 256 distinct byte values, so for larger arrays it is simpler to count the bytes.
  Since:
    January 25, 2023
  Author:
    Rammi

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `NUM_CHARS` Number of different char values.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FastSortChar()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `sort(byte[] bytes)` Sort the given byte array in natural order.
    `static void` | `sort(char[] chars, CharOrdering order)` Sort the given char array in user-defined order.
    `static void` | `sort(char[] chars, int startIndex, int length)` Sort a part of the given char array in natural order.
    `static void` | `sort(char[] chars, int startIndex, int length, CharOrdering order)` Sort a part of the given char array in user-defined order.
    `static void` | `sort(MutableCharIndexable chars)` Sort the given mutable char indexable in natural order.
    `static void` | `sort(MutableCharIndexable chars, CharOrdering order)` Sort the given mutable char indexable by the defined order.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NUM_CHARS

          public static final int NUM_CHARS

      Number of different char values.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### FastSortChar

          public FastSortChar()

  - ### Method Detail

    - #### sort

          public static void sort(@NotNull
                                  byte[] bytes)

      Sort the given byte array in natural order. This will forward to `Arrays.sort(byte[])`.
      Parameters:
        `bytes` - byte array

    - #### sort

          public static void sort(@NotNull
                                  char[] chars,
                                  @NotNull
                                  CharOrdering order)

      Sort the given char array in user-defined order. This will forward to `Arrays.sort(char[])`.
      Parameters:
        `chars` - char array
        `order` - sort order

    - #### sort

          public static void sort(@NotNull
                                  char[] chars,
                                  int startIndex,
                                  int length)

      Sort a part of the given char array in natural order. This will forward to `Arrays.sort(char[],int,int)`.
      Parameters:
        `chars` - char array
        `startIndex` - start index into the char array where the part to be sorted begins
        `length` - length of the part to be sorted

    - #### sort

          public static void sort(@NotNull
                                  char[] chars,
                                  int startIndex,
                                  int length,
                                  @NotNull
                                  CharOrdering order)

      Sort a part of the given char array in user-defined order. This will forward to `Arrays.sort(char[],int,int)`.
      Parameters:
        `chars` - char array
        `startIndex` - start index into the char array where the part to be sorted begins
        `length` - length of the part to be sorted
        `order` - sort order

    - #### sort

          public static void sort(@NotNull
                                  MutableCharIndexable chars)

      Sort the given mutable char indexable in natural order.
      Parameters:
        `chars` - char indexable

    - #### sort

          public static void sort(@NotNull
                                  MutableCharIndexable chars,
                                  @NotNull
                                  CharOrdering order)

      Sort the given mutable char indexable by the defined order.
      Parameters:
        `chars` - char indexable
        `order` - sort order