@Test public void testEmptyAndSingle() { int[] mSortOrder = IndirectSort.mergesort(0, 0, Integer::compare); Assert.assertEquals(mSortOrder.length, 0); for (int i = 0; i < 1000; i++) { mSortOrder = IndirectSort.mergesort(0, i, Integer::compare); Assert.assertEquals(mSortOrder.length, i); } }
public static int[] mergesort(int start, int length, IntBinaryOperator comparator) { final int[] src = createOrderArray(start, length); if (length > 1) { final int[] dst = (int[]) src.clone(); topDownMergeSort(src, dst, 0, length, comparator); return dst; } return src; }
IndirectSort { public static int[] mergesort(int start, int length, IntBinaryOperator comparator) { final int[] src = createOrderArray(start, length); if (length > 1) { final int[] dst = (int[]) src.clone(); topDownMergeSort(src, dst, 0, length, comparator); return dst; } return src; } }
IndirectSort { public static int[] mergesort(int start, int length, IntBinaryOperator comparator) { final int[] src = createOrderArray(start, length); if (length > 1) { final int[] dst = (int[]) src.clone(); topDownMergeSort(src, dst, 0, length, comparator); return dst; } return src; } private  IndirectSort(); }
IndirectSort { public static int[] mergesort(int start, int length, IntBinaryOperator comparator) { final int[] src = createOrderArray(start, length); if (length > 1) { final int[] dst = (int[]) src.clone(); topDownMergeSort(src, dst, 0, length, comparator); return dst; } return src; } private  IndirectSort(); static int[] mergesort(int start, int length, IntBinaryOperator comparator); static int[] mergesort(
      T[] input, int start, int length, Comparator<? super T> comparator); }
IndirectSort { public static int[] mergesort(int start, int length, IntBinaryOperator comparator) { final int[] src = createOrderArray(start, length); if (length > 1) { final int[] dst = (int[]) src.clone(); topDownMergeSort(src, dst, 0, length, comparator); return dst; } return src; } private  IndirectSort(); static int[] mergesort(int start, int length, IntBinaryOperator comparator); static int[] mergesort(
      T[] input, int start, int length, Comparator<? super T> comparator);  }