java.lang.UnsupportedOperationException when i try to set value in Muttablelist kotlin
You can fix this by calling toMutableList() api
rather than using smart cast (as).
fun main(){
val x : List<String> = listOf("foo", "bar", "baz")
//val y: MutableList<String> = x as MutableList<String> throws UnsupportedOperationException
val y: MutableList<String> = x.toMutableList()
y.add("sha")
println(y) // [foo, bar, baz, sha]
}