There is Map’s key, value ,mapper function? I foun...
# stdlib
u
There is Map’s key, value ,mapper function? I found mapKeys, mapValues function but no mapKeyValues functions.
p
Copy code
mapOf<String, String>().entries.associate { (key, value) -> key to value }
just use
entries.associate
?
plus green 1
u
wow thats great! thanks!
e
BTW if you want exactly that result (a list of pairs), just use
.toList()
on the Map itself
👀 1
k
It's just called `map`:
Copy code
mapOf<String, String>().map { (key, value) -> foo(key, value) }
🙌 1