@Override public void sortAscending() { ByteArrays.mergeSort(data.elements()); }
@Override public void sortDescending() { ByteArrays.mergeSort(data.elements(), descendingByteComparator); }
/** * Sorts an array according to the natural ascending order using mergesort. * * <p> * This sort is guaranteed to be <i>stable</i>: equal elements will not be * reordered as a result of the sort. An array as large as {@code a} will be * allocated by this method. * * @param a * the array to be sorted. */ public static void mergeSort(final byte a[]) { mergeSort(a, 0, a.length); } /**
/** * Sorts an array according to the order induced by the specified comparator * using mergesort. * * <p> * This sort is guaranteed to be <i>stable</i>: equal elements will not be * reordered as a result of the sort. An array as large as {@code a} will be * allocated by this method. * * @param a * the array to be sorted. * @param comp * the comparator to determine the sorting order. */ public static void mergeSort(final byte a[], ByteComparator comp) { mergeSort(a, 0, a.length, comp); } /**
@Override public void sortAscending() { ByteArrays.mergeSort(data.elements()); }
@Override public void sortAscending() { ByteArrays.mergeSort(data.elements()); }
@Override public void sortDescending() { ByteArrays.mergeSort(data.elements(), descendingByteComparator); }
@Override public void sortDescending() { ByteArrays.mergeSort(data.elements(), reverseByteComparator); }
/** * Sorts the specified range of elements according to the order induced by the * specified comparator using mergesort. * * <p> * This sort is guaranteed to be <i>stable</i>: equal elements will not be * reordered as a result of the sort. An array as large as {@code a} will be * allocated by this method. * * @param a * the array to be sorted. * @param from * the index of the first element (inclusive) to be sorted. * @param to * the index of the last element (exclusive) to be sorted. * @param comp * the comparator to determine the sorting order. */ public static void mergeSort(final byte a[], final int from, final int to, ByteComparator comp) { mergeSort(a, from, to, comp, a.clone()); } /**
/** * Sorts the specified range of elements according to the natural ascending * order using mergesort. * * <p> * This sort is guaranteed to be <i>stable</i>: equal elements will not be * reordered as a result of the sort. An array as large as {@code a} will be * allocated by this method. * * @param a * the array to be sorted. * @param from * the index of the first element (inclusive) to be sorted. * @param to * the index of the last element (exclusive) to be sorted. */ public static void mergeSort(final byte a[], final int from, final int to) { mergeSort(a, from, to, a.clone()); } /**