https://kotlinlang.org logo
#announcements
Title
# announcements
d

df

07/25/2020, 6:07 PM
Copy code
data class Dummy(val namespace: String, val key: String, val value: String)
val dummies = listOf(...)

// do sth. with dummies

// expected: Map<String (namespace), Map<String (key), String (value)>>
r

Robert Jaros

07/25/2020, 6:14 PM
d

df

07/25/2020, 6:15 PM
Thanks already... My brain needs some time to digest the double map
f

Fleshgrinder

07/25/2020, 6:33 PM
val expected = dummies.groupBy { it.namespace }.mapValues { it.value.associate { it.key to it.value } }
this is more efficient.
d

df

07/25/2020, 7:49 PM
and easier to read, thanks
6 Views