https://kotlinlang.org logo
#codereview
Title
# codereview
d

dfriehs

02/18/2020, 1:36 PM
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
.
3 Views