Reposting it here <https://kotlinlang.slack.com/ar...
# codereview
d
Instead of creating a mutable list and adding elements, i would consider using
map
:
Copy code
val newList = studentList.map {
  if (it.id == student.id) it.copy(isFailed = false)
  else it.copy()
}
Should the objects inside themselves be deep-copied, consider either implementing
Cloneable
or in the case of data classes, call
copy
.