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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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]) | |
} |
Comments
Post a Comment