what am I doing wrong here guys? ``` class Test()...
# getting-started
p
what am I doing wrong here guys?
Copy code
class Test() {
    var l: List<Int> = mutableListOf()

    init {
        l.add(4) // Unresolved
    }
}
a
your
l
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
p
oh... and I guess this is implemented by some weird special cases in the compiler?
a
you are using
kotlin.collections.List
(https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/) by default instead of the Java-List
c
@poohbar Not sure what you mean by "weird special case".