Provide mutableSetOf and mutableMapOf

#KT-9663 Fixed
This commit is contained in:
Ilya Gorbunov
2016-01-16 05:49:57 +03:00
parent fe8ba4d356
commit aafd79078f
4 changed files with 17 additions and 1 deletions
@@ -209,6 +209,12 @@ class MapTest {
assertEquals(2, map["b"])
}
@test fun createMutableMap() {
val map = mutableMapOf("b" to 1, "c" to 2)
map.put("a", 3)
assertEquals(listOf("b" to 1, "c" to 2, "a" to 3), map.toList())
}
@test fun createLinkedMap() {
val map = linkedMapOf(Pair("c", 3), Pair("b", 2), Pair("a", 1))
assertEquals(1, map["a"])
@@ -56,7 +56,7 @@ class SetOperationsTest {
assertEquals(setOf("a", "foo", "beer", "cheese", "bar"), set)
assertTrue(set !== setOriginal)
val mset = hashSetOf("a")
val mset = mutableSetOf("a")
mset += "foo"
mset += listOf("beer", "a")
mset += arrayOf("cheese", "beer")