fill
reverse
shuffle
sort
这可能会在运行时导致 UnsupportedOperationException。
UnsupportedOperationException
示例:
import java.util.Collections fun test() { val immutableList = listOf(1, 2) Collections.reverse(immutableList) }
要修正此问题,请使列表可变。