Is the map returned by mutableMapOf(...) multihrea...
# random
b
Is the map returned by mutableMapOf(...) multihread-capable? E.g. is it a ConcurrentHashMap or something similiar? If not, what map should I use in multithreading environment. e.g ConcurrentHashMap?
d
It is not thread safe. Yes use ConcurrentHashMap.
👍 1
r
Probably better asked in #getting-started, incidentally. Also - you can just CTL/CMD click through to see its definition in IntelliJ, which will show you it's a
kotlin.collections.LinkedHashMap
, which is an
expect class
. Unfortunately IntelliJ doesn't make it easy to go from an
expect class
to an
actual class
(as far as I can see) but if you look in
kotlin-stdlib-1.6.10.jar!/kotlin/collections/TypeAliases.kt
you'll see that
public actual typealias LinkedHashMap<K, V> = java.util.LinkedHashMap<K, V>
.
👍 1
y
Unfortunately IntelliJ doesn't make it easy to go from an
expect class
to an
actual class
A good trick I've used is to Ctrl-Shift-F (Search everywhere) and then Scope -> All Places and search for a
actual class ClassName
or
actual typealias ClassName
r
Yup, that's how I found that one! But it's not nearly as convenient as navigating from, e.g., interface -> implementations.
Having said that there's no easy way to get from
kotlin.collections.MutableMap
to its implementations either... looks like some of the hierarchy navigation doesn't work inside dependency sources?