Ellen Spertus
values: mutableMapOf<String, List<String>
values[key] = (values[key] ?: emptyList()) + value
getOrDefault()
deactivateduser
fun MutableMap<String, MutableList<String>>.add(key: String, value: String) = this[key]?.run { add(value) } ?: set(key, mutableListOf(value))
Marc Knaup
val values = mutableMapOf<String, MutableList<String>>() fun add(key: String, value: String) { values.getOrPut(key) { mutableListOf() }.add(value) }
A modern programming language that makes developers happier.