I want output to be: [3.0, 2.36, 1.1] of keys and in the same way sorted values [three, one, two]
fun main() {
var l = 0
var letters = arrayOf("one", "two", "three")
var digits = arrayOf(2.36, 1.1, 3.0)
var list = mutableMapOf<Double, String>()
repeat(3)
{
list.put(digits[l], letters[l])
l++
}
println(list.toSortedMap(compareByDescending<Double> { list[it]) })
}
How can I do that? In my attempt code changes to
[1.1, 3.0, 2.36]
[two, three, one]