Why isn't there a `map.merge` function? (or if the...
# stdlib
l
Why isn't there a
map.merge
function? (or if there is, why can't I find it? xD) in plain Java it exists . I'm in a Kotlin JVM project
g
It’s there: https://pl.kotl.in/z5EVUChRZ Just make sure that you use MutableMap in Kotlin (this operation modifies map, so it’s not available in Map)
l
Interesting. On the project I'm working on it's only there if I use
hashmapOf
Likely IntelliJ pulling some shenanigans
Thanks @gildor!
g
mutableMapOf should also work, maybe you use read only map instead
l
Screenshot from 2021-01-22 02-18-41.png
I think it's basically the same as yours
This test actually executes, but IntelliJ points that compiler error
If I change to
hashmapOf
it works both in IntelliJ and executing the test
g
huh, indeed