Package arc.struct

Class Sort

java.lang.Object
arc.struct.Sort

public class Sort extends Object
Provides methods to sort arrays of objects. Sorting requires working memory and this class allows that memory to be reused to avoid allocation. The sorting is otherwise identical to the Arrays.sort methods (uses timsort).

Note that sorting primitive arrays with the Arrays.sort methods does not allocate memory (unless sorting large arrays of char, short, or byte).
  • Constructor Details

    • Sort

      public Sort()
  • Method Details

    • instance

      public static Sort instance()
      Returns a Sort instance for convenience. Multiple threads must not use this instance at the same time.
    • sort

      public <T> void sort(Seq<T> a)
    • sort

      public <T> void sort(T[] a)
    • sort

      public <T> void sort(T[] a, int fromIndex, int toIndex)
    • sort

      public <T> void sort(Seq<T> a, Comparator<? super T> c)
    • sort

      public <T> void sort(T[] a, Comparator<? super T> c)
    • sort

      public <T> void sort(T[] a, Comparator<? super T> c, int fromIndex, int toIndex)