sortedByKey

inline fun <K, V> Map<K, V>.sortedByKey(): Map<K, V>

Returns a map of all elements sorted by key.

Example:

mapOf(1 to 0, 5 to 1, 10 to 10, 7 to 0).sortedByKey()
// {1:0, 7:0, 5:1, 10:10}
mapOf(1 to "a", 2 to "0", 3 to "11", 4 to "01", 5 to "1").sortedByKey()
// {2:"0", 4:"01", 5:"1", 3:"11", 1:"a"}

Since

1.1.0