quick question which i feel like i should know the...
# announcements
z
quick question which i feel like i should know the answer to: if i have an immutable map and call .toMutableMap on it and change the resulting map, does it change the first immutable one?
n
easy to click through to the source in IntelliJ 🙂 but I think all the .to* methods make a copy. even Map#toMap makes a copy.
Copy code
public fun <K, V> Map<out K, V>.toMutableMap(): MutableMap<K, V> = LinkedHashMap(this)
z
yeah actually that was my first thought but for some reason its only showing decompiled bytecode
it wont let me see the source ;-;
thats another unrelated issue
and alright thanks!!
r
normally you can provide a trailing implementation of the map you want if your worried about rehashing the map
z
hmm, what's a trailing implementation?
r
not sure how you are making your map
but you can provide the map
z
i see, thanks! I think i figured it out another way though. appreciate the help