Skip to content

Instantly share code, notes, and snippets.

@sajjadyousefnia
Created April 2, 2018 09:18
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 sajjadyousefnia/cee101469326b81d5e22d1992808f8bb to your computer and use it in GitHub Desktop.
Save sajjadyousefnia/cee101469326b81d5e22d1992808f8bb to your computer and use it in GitHub Desktop.
// a mutable list of a certain type e.g. String
val mutableListNames: MutableList<String> = mutableListOf<String>("Josh", "Kene", "Sanya")
mutableListNames.add("Mary")
mutableListNames.removeAt(1)
mutableListNames[0] = "Oluchi" // replaces the element in index 0 with "Oluchi"
// a mutable list of mixed types
val mutableListMixed = mutableListOf("BMW", "Toyota", 1, 6.76, 'v')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment