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
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