toSortedMap() without a comparator requires keys that are Comparable.

This commit is contained in:
Ilya Ryzhenkov
2015-02-17 20:41:10 +03:00
parent bfeb21afb0
commit e00cdfc8e1
@@ -17,7 +17,7 @@ public fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = put(key, value)
*
* @sample test.collections.MapJVMTest.toSortedMap
*/
public fun <K : Any, V> Map<K, V>.toSortedMap(): SortedMap<K, V> = TreeMap(this)
public fun <K : Comparable<K>, V> Map<K, V>.toSortedMap(): SortedMap<K, V> = TreeMap(this)
/**
* Converts this [Map] to a [SortedMap] using the given [comparator] so that iteration order will be in the order