首页 > 解决方案 > synchronizedList.toCollections 是否需要同步?

问题描述

val listA = Collections.synchronizedList<Int>(mutableListOf())
// ..... some code goes here...
listB = listA.toCollection(mutableListOf())) // Copy the results


// Runs in a different thread
fun A(listA)  {
 listA.add(10)
}

listA.toCollection 是否需要同步?

标签: javakotlinkotlin-coroutines

解决方案


推荐阅读