Package com.yahoo.search.predicate.utils
Class PrimitiveArraySorter
java.lang.Object
com.yahoo.search.predicate.utils.PrimitiveArraySorter
This class enables sorting of an array of primitive short values using a supplied comparator for custom ordering.
The sort methods in Java standard library cannot sort using a comparator for primitive arrays.
Sorting is performed using Quicksort.
- Author:
- bjorncs
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
merge
(short[] array, short[] mergeArray, int pivotIndex, int toIndex, PrimitiveArraySorter.ShortComparator comparator) static void
merge
(short[] array, short[] mergeArray, int pivotIndex, PrimitiveArraySorter.ShortComparator comparator) static void
sort
(short[] array, int fromIndex, int toIndex, PrimitiveArraySorter.ShortComparator comparator) static void
sort
(short[] array, PrimitiveArraySorter.ShortComparator comparator) static boolean
sortAndMerge
(short[] array, short[] mergeArray, int pivotIndex, int toIndex, PrimitiveArraySorter.ShortComparator comparator)
-
Method Details
-
sort
-
sort
public static void sort(short[] array, int fromIndex, int toIndex, PrimitiveArraySorter.ShortComparator comparator) -
sortAndMerge
public static boolean sortAndMerge(short[] array, short[] mergeArray, int pivotIndex, int toIndex, PrimitiveArraySorter.ShortComparator comparator) -
merge
public static void merge(short[] array, short[] mergeArray, int pivotIndex, PrimitiveArraySorter.ShortComparator comparator) -
merge
public static void merge(short[] array, short[] mergeArray, int pivotIndex, int toIndex, PrimitiveArraySorter.ShortComparator comparator)
-