Different b/t mutable List and listOf in Android kotlin
In Kotlin, there are two types of lists: immutable lists and mutable lists.
Immutable lists cannot be modified after they are created. They are created using the
listOf() function. For example:val immutableList = listOf("a", "b", "c")
Once the immutable list is created, you cannot add, remove, or change any of the elements in the list.
Mutable lists, on the other hand, can be modified after they are created. They are created using the
mutableListOf() function. For example:val mutableList = mutableListOf("a", "b", "c")
Comments
Post a Comment