public static <T> int[] sort(
		final Seq<? extends T> array,
		final Comparator<? super T> comparator
	) {
		final IndexSorter sorter = array.size() < INSERTION_SORT_THRESHOLD
			? InsertionSorter.INSTANCE
			: HeapSorter.INSTANCE;

		return sorter.sort(array, indexes(array.size()), comparator);
	}
public static < T > int [ ] sort ( final Seq < ? extends T > array , final Comparator < ? super T > comparator ) { final IndexSorter sorter = array . size ( ) < INSERTION_SORT_THRESHOLD ? InsertionSorter . INSTANCE : HeapSorter . INSTANCE ; return sorter . sort ( array , indexes ( array . size ( ) ) , comparator ) ; }
Sorting the given {@code array} by changing the given {@code indexes}.
The order of the original {@code array} stays unchanged.

@param array the array to sort
@param comparator the comparator used for sorting the array
@param <T> the element type
@return the given {@code indexes} which is now "sorted"
@throws NullPointerException if one of the arguments is {@code null}