jodd.util.sort.FastSort Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jodd-core Show documentation
Show all versions of jodd-core Show documentation
Jodd Core tools and utilities, including type converters, JDateTime, cache etc.
// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.
package jodd.util.sort;
import java.util.Comparator;
/**
* Fast sort.
*
* In JDK {@literal <} v7, implementation of merge sort (implemented in Arrays.sort
) is
* not the best one: there is redundant object array cloning, many small methods that
* can be inlined etc.
*
* This class brings the best sorting implementations, so they can be used on JDK5 and JDK6, too.
*/
public class FastSort {
/**
* Sorts an array using given comparator.
*/
public static void sort(T array[], Comparator comparator) {
TimSort.sort(array, comparator);
}
/**
* Sorts an array of comparables.
*/
public static void sort(Comparable array[]) {
ComparableTimSort.sort(array);
}
}