(imutable collection is mutable) returns true in Kotlin
问题 Why this is happening in Kotlin: val list: List<Int> = listOf(1, 2, 3)// Immutable list if(list is MutableCollection<*>){// why this "if" condition is true? println("is mutable")// this line is printed (list as MutableCollection<Int>).add(4) // this results to java.lang.UnsupportedOperationException } list is MutableCollection returns true that shows Kotlin Immutable collection objects implements MutableCollection interface but instead of changing items in collection it throws