Mutable and Immutable List in Kotlin

Immutable List can't be editable like add, edit or delete but we can retrieve the data
Mutable List can be editable by add, edit, or delete


/* Mutable & Immutable List */
fun main(args: Array<String>) {
/* mutable list can editable,
Immutable List can't be editable
*/
val immutableList = listOf(
1,3,4,5,6,7
)
println(immutableList[0])
}
view raw gistfile1.txt hosted with ❤ by GitHub

Comments

Popular posts from this blog

Your build is currently configured to use incompatible Java 21.0.3 and Gradle 8.2.1. Cannot sync the project.

Google Assistant Implementation in Android application with app actions