If I try to use the Java List a warning message comes up “This class shouldn’t be used in Kotlin…”
Java lists (and other collections) are mapped types in Kotlin. So you can use Collections.synchronizedList
, and it takes and returns a Kotlin List
or MutableList
.
OTOH, synchronizedList
is rarely what you actually want: it works for single method calls, but anything else must be synchronized manually.