poohbar
04/23/2017, 12:48 PMclass Test() {
var l: List<Int> = mutableListOf()
init {
l.add(4) // Unresolved
}
}
Andreas Sinz
04/23/2017, 12:56 PMl
is of type List<Int>
, which is read-only in kotlin. use MutableList<Int>
instead or completly remove the type. kotlin is able to infer the type of l
poohbar
04/23/2017, 12:58 PMAndreas Sinz
04/23/2017, 1:05 PMkotlin.collections.List
(https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/) by default instead of the Java-Listcedric
04/23/2017, 2:48 PM