sortIndices

Returns a list holding the indices of the sorted items in the array


fun <T : Comparable<T>> List<T>.sortIndices(descending: Boolean = false): List<Int>(source)

Returns a list holding the indices of the sorted items in the list

Parameters

descending

if true, the sort will be descending rather than ascending. The default is false (ascending).


fun DoubleArray.sortIndices(descending: Boolean = false): IntArray(source)
fun IntArray.sortIndices(descending: Boolean = false): IntArray(source)

Constructs an array that holds the indices of the items in the data in their sort order. Example: If the array is 2,3,1,4,5, then 2,0,1,3,4 is returned. Recall that indices are zero-based.

Return

the indices of the original items indicating the sort order

Parameters

descending

if true, the sort will be descending rather than ascending. The default is false (ascending).