Skip to content

Instantly share code, notes, and snippets.

@Ayeeta
Created August 3, 2020 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ayeeta/074a171898115f5d80a4c263f394eb6a to your computer and use it in GitHub Desktop.
Save Ayeeta/074a171898115f5d80a4c263f394eb6a to your computer and use it in GitHub Desktop.
About collections - mutable
/**
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