Package org.apache.commons.lang3

# Class ArraySorter

java.lang.Object
org.apache.commons.lang3.ArraySorter

public class ArraySorter extends Object
Sorts and returns arrays in the fluent style. TODO For 4.0, rename to ArraySort, since we cover the sort() method here, see also ArrayFill.

Since:
  3.12.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ArraySorter()`
  Deprecated.
  Will be removed in 4.0.0.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static byte[]`
  `sort(byte[] array)`
  Sorts the given array into ascending order and returns it.
  `static char[]`
  `sort(char[] array)`
  Sorts the given array into ascending order and returns it.
  `static double[]`
  `sort(double[] array)`
  Sorts the given array into ascending order and returns it.
  `static float[]`
  `sort(float[] array)`
  Sorts the given array into ascending order and returns it.
  `static int[]`
  `sort(int[] array)`
  Sorts the given array into ascending order and returns it.
  `static long[]`
  `sort(long[] array)`
  Sorts the given array into ascending order and returns it.
  `static short[]`
  `sort(short[] array)`
  Sorts the given array into ascending order and returns it.
  `static <T> T[]`
  `sort(T[] array)`
  Sorts the given array into ascending order and returns it.
  `static <T> T[]`
  `sort(T[] array, Comparator<? super T> comparator)`
  Sorts the given array into ascending order and returns it.

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

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

- ## Constructor Details

  - ### ArraySorter

    @Deprecated public ArraySorter()
    Deprecated.
    Will be removed in 4.0.0.
    Constructs a new instance.

- ## Method Details

  - ### sort

    public static byte[] sort(byte[] array)
    Sorts the given array into ascending order and returns it.
    Parameters:
      `array` - the array to sort (may be null).
    Returns:
      the given array.
    See Also:
      - `Arrays.sort(byte[])`

  - ### sort

    public static char[] sort(char[] array)
    Sorts the given array into ascending order and returns it.
    Parameters:
      `array` - the array to sort (may be null).
    Returns:
      the given array.
    See Also:
      - `Arrays.sort(char[])`

  - ### sort

    public static double[] sort(double[] array)
    Sorts the given array into ascending order and returns it.
    Parameters:
      `array` - the array to sort (may be null).
    Returns:
      the given array.
    See Also:
      - `Arrays.sort(double[])`

  - ### sort

    public static float[] sort(float[] array)
    Sorts the given array into ascending order and returns it.
    Parameters:
      `array` - the array to sort (may be null).
    Returns:
      the given array.
    See Also:
      - `Arrays.sort(float[])`

  - ### sort

    public static int[] sort(int[] array)
    Sorts the given array into ascending order and returns it.
    Parameters:
      `array` - the array to sort (may be null).
    Returns:
      the given array.
    See Also:
      - `Arrays.sort(int[])`

  - ### sort

    public static long[] sort(long[] array)
    Sorts the given array into ascending order and returns it.
    Parameters:
      `array` - the array to sort (may be null).
    Returns:
      the given array.
    See Also:
      - `Arrays.sort(long[])`

  - ### sort

    public static short[] sort(short[] array)
    Sorts the given array into ascending order and returns it.
    Parameters:
      `array` - the array to sort (may be null).
    Returns:
      the given array.
    See Also:
      - `Arrays.sort(short[])`

  - ### sort

    public static <T> T[] sort(T[] array)
    Sorts the given array into ascending order and returns it.
    Type Parameters:
      `T` - the array type.
    Parameters:
      `array` - the array to sort (may be null).
    Returns:
      the given array.
    See Also:
      - `Arrays.sort(Object[])`

  - ### sort

    public static <T> T[] sort(T[] array, Comparator<? super T> comparator)
    Sorts the given array into ascending order and returns it.
    Type Parameters:
      `T` - the array type.
    Parameters:
      `array` - the array to sort (may be null).
      `comparator` - the comparator to determine the order of the array. A `null` value uses the elements' `natural ordering`.
    Returns:
      the given array.
    See Also:
      - `Arrays.sort(Object[])`