libgdx API

com.badlogic.gdx.utils
Class Sort

java.lang.Object
  extended by com.badlogic.gdx.utils.Sort

public class Sort
extends java.lang.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).

Author:
Nathan Sweet

Constructor Summary
Sort()
           
 
Method Summary
static Sort instance()
          Returns a Sort instance for convenience.
<T> void
sort(Array<T> a)
           
<T> void
sort(Array<T> a, java.util.Comparator<T> c)
           
<T> void
sort(T[] a)
           
<T> void
sort(T[] a, java.util.Comparator<T> c)
           
<T> void
sort(T[] a, java.util.Comparator<T> c, int fromIndex, int toIndex)
           
<T> void
sort(T[] a, int fromIndex, int toIndex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sort

public Sort()
Method Detail

sort

public <T> void sort(Array<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(Array<T> a,
                     java.util.Comparator<T> c)

sort

public <T> void sort(T[] a,
                     java.util.Comparator<T> c)

sort

public <T> void sort(T[] a,
                     java.util.Comparator<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.


libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)