Created
August 3, 2020 08:12
-
-
Save Ayeeta/074a171898115f5d80a4c263f394eb6a to your computer and use it in GitHub Desktop.
About collections - mutable
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 lists/arrays use arrayListOf() method | |
Notice it has other methods to add to the list | |
**/ | |
val mutableAlphabetsLists = arrayListOf("c","d","b","a") | |
println(mutableAlphabetsLists) | |
println(mutableAlphabetsLists.size) | |
println(mutableAlphabetsLists.add("x")) | |
println(mutableAlphabetsLists) | |
println(mutableAlphabetsLists.add(0, "z")) | |
println(mutableAlphabetsLists) | |
println(mutableAlphabetsLists.removeAt(3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment