sortIndices

fun sortIndices(data: DoubleArray, descending: Boolean = false): IntArray(source)
fun sortIndices(data: IntArray, 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

data

the data to sort

descending

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