How is the idiomatic way to modify the value of a ...
# announcements
p
How is the idiomatic way to modify the value of a list for the desired object? I mean instead of doing it manually like list[1].name = "name" is there any other idiomatic way to do so? I want to modify all of the values of a list with different "names".
n
If the elements are instances of a data class, you can use map and copy
list.map { it.copy(name=newNameFor(it) }