Package com.badlogic.gdx.utils
Class Sort
- java.lang.Object
-
- com.badlogic.gdx.utils.Sort
-
public class Sort extends java.lang.ObjectProvides 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 Summary
Constructors Constructor Description Sort()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Sortinstance()Returns a Sort instance for convenience.<T extends java.lang.Comparable>
voidsort(Array<T> a)<T> voidsort(Array<T> a, java.util.Comparator<? super T> c)voidsort(java.lang.Object[] a)The specified objects must implementComparable.voidsort(java.lang.Object[] a, int fromIndex, int toIndex)The specified objects must implementComparable.<T> voidsort(T[] a, java.util.Comparator<? super T> c)<T> voidsort(T[] a, java.util.Comparator<? super T> c, int fromIndex, int toIndex)
-
-
-
Method Detail
-
sort
public <T extends java.lang.Comparable> void sort(Array<T> a)
-
sort
public void sort(java.lang.Object[] a)
The specified objects must implementComparable.
-
sort
public void sort(java.lang.Object[] a, int fromIndex, int toIndex)The specified objects must implementComparable.
-
sort
public <T> void sort(Array<T> a, java.util.Comparator<? super T> c)
-
sort
public <T> void sort(T[] a, java.util.Comparator<? super T> c)
-
sort
public <T> void sort(T[] a, java.util.Comparator<? super T> c, int fromIndex, int toIndex)
-
instance
public static Sort instance()
Returns a Sort instance for convenience. Multiple threads must not use this instance at the same time.
-
-