Is there a Kotlin equivalent of Java’s Collections.synchronizedList ? Or is this not needed in Kotlin

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)