Create SortedMap with Comparator and items
KT-34142
This commit is contained in:
committed by
Ilya Gorbunov
parent
e3fb74b656
commit
c023a02884
@@ -43,6 +43,13 @@ class Maps {
|
||||
assertPrints(map.values, "[2, 3, 1]")
|
||||
}
|
||||
|
||||
@Sample
|
||||
fun sortedMapWithComparatorFromPairs() {
|
||||
val map = sortedMapOf(compareBy<String> { it.length }.thenBy { it }, Pair("abc", 1), Pair("c", 3), Pair("bd", 4), Pair("bc", 2))
|
||||
assertPrints(map.keys, "[c, bc, bd, abc]")
|
||||
assertPrints(map.values, "[3, 2, 4, 1]")
|
||||
}
|
||||
|
||||
@Sample
|
||||
fun emptyReadOnlyMap() {
|
||||
val map = emptyMap<String, Int>()
|
||||
|
||||
Reference in New Issue
Block a user