Introduce associateTo and associateByTo with the destination MutableMap to fill.

This commit is contained in:
Ilya Gorbunov
2016-01-22 20:44:50 +03:00
parent e41bf687d9
commit 564155734b
6 changed files with 635 additions and 282 deletions
@@ -44,7 +44,7 @@ class MapJVMTest {
}
@test fun iterateAndRemove() {
val map = (1..5).associateBy({ it }, { 'a' + it }).toLinkedMap() // TODO: use associateByTo(linkedMapOf())
val map = (1..5).associateByTo(linkedMapOf(), { it }, { 'a' + it })
val iterator = map.iterator()
while (iterator.hasNext()) {
if (iterator.next().key % 2 == 0)