compareTo

fun <T : Number> Number.compareTo(other: T): Int

This function is a piece of pure magic. It is one of the missing pieces in the Kotlin language and compares an arbitrary Number with another Number using the dedicated compareTo functions for the individual implementations of Number, such as Int.compareTo.