``` val parameterObject = element?.asJsonObject va...
# android
a
Copy code
val parameterObject = element?.asJsonObject
val parameters: Map<String, List<String>> = HashMap()
for (entry in parameterObject?.entrySet().orEmpty()) {
    val key = entry.key
    val value = entry.value.asString
    parameters.put(key, value)
}
l
a
Thanks @Lucas Ł!
a
your map is mutable, but then you narrow the type down to immutable
either do
Copy code
val parameters = HashMap<String, List<String>>()
or
Copy code
val parameters: MutableMap<String, List<String>> = HashMap()
l
or
Copy code
val parameters = mutableMapOf<String, List<String>>()
a
I assumed he cared about the implementing type, but if you don't care about it, that's the best one to use
a
Thanks guys.
I managed to implement it.
I though if I don't defined anything.
I would be MutableList by default.
a
only if it comes from Java
t
Let's not get into the ways we could do this. This is Kotlin, we'd be here all year :p