+ 17
The listOf() is immutable, means you can't change the value. Eg - var k = listOf(5,6,4) k[0] = 9 It will give me error because it's immutable you can't edit it. And mutanleList() ,means you can edit it. For eg - var k = mutableListOf(5,6,5) k[0] = 2 Now k's 0th elements is 2 It's similar to python's list and tuple Mutable eg - https://code.sololearn.com/c6rxHrLaw88Y/?ref=app Immutable - https://code.sololearn.com/c80ftobWcF8a/?ref=app please read the single-line comment. ------------------------------------------- It seems that you have entered in Kotlin Documentation! All the best Mr Paul
13th Feb 2021, 6:17 AM
Abhiyantā
Abhiyantā - avatar
+ 5
Check this. I'm not an expert of Kotlin. https://stackoverflow.com/questions/46445909/difference-between-mutablelist-and-list-in-kotlin#:~:text=List%3A%20A%20generic%20ordered%20collection,supports%20adding%20and%20removing%20elements.&text=In%20a%20List%20you%20can%20only%20read%20them.
12th Feb 2021, 11:09 PM
Gabriele Gatti
Gabriele Gatti - avatar
+ 5
Kotlin List & Mutable List tutorial with examples. https://bezkoder.com/kotlin-list-mutable-list/
12th Feb 2021, 11:20 PM
Apongpoh Gilbert
Apongpoh Gilbert - avatar
+ 2
List r immutable and readonly, u cannot add, remove, re-write elements in it, whereas in MutableList u can do it.
13th Feb 2021, 2:48 PM
MOHAN👨🏻‍💻
MOHAN👨🏻‍💻 - avatar