<@U0L2E3CLR>: Here’s an example of how things can ...
# announcements
j
@richardagreen: Here’s an example of how things can go very badly awry with your implementation:
Copy code
val m = hashMapOf(1 to "2", 2 to "3", 3 to "1")
    val s = m.toSortedMap(compareBy { m[it] })

    println("m = ${m}")
    println("s = ${s}")

    m.put(1, "5")

    println("m = ${m}")
    println("s = ${s}")

    s.put(2, "6")

    println("m = ${m}")
    println("s = ${s}")