Kotlin’s List missing “add”, “remove”, Map missing “put”, etc?
Unlike many languages, Kotlin distinguishes between mutable and immutable collections (lists, sets, maps, etc). Precise control over exactly when collections can be edited is useful for eliminating bugs, and for designing good APIs. https://kotlinlang.org/docs/reference/collections.html You’ll need to use a MutableList list. class TempClass { var myList: MutableList<Int> = mutableListOf<Int>() fun doSomething() { // myList = … Read more