Skip to content

Instantly share code, notes, and snippets.

@priort
Last active July 11, 2019 07:57
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 priort/18207c8706207ef087705d5fdcf05b88 to your computer and use it in GitHub Desktop.
Save priort/18207c8706207ef087705d5fdcf05b88 to your computer and use it in GitHub Desktop.
fun main(args: Array<String>) {
val mutableList: MutableList<Int> = mutableListOf(4, 5, 6)
val listNotToBeAmended: List<Int> = mutableList
println("listNotToBeAmended before add: $listNotToBeAmended")
mutableList.add(3)
println("listNotToBeAmended after add to underlying list: $listNotToBeAmended")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment