Evan R.
06/03/2020, 12:44 PM.map()
creates a copy of the original listoday
06/03/2020, 12:54 PMhttps://i.imgur.com/UaqMvEv.jpg▾
Matias Reparaz
06/03/2020, 1:09 PModay
06/03/2020, 1:10 PMit.items.toMutableList()[searchMatchIdx].toggled
it’s still falseit.items.toMutableList()[searchMatchIdx] =
it.items[searchMatchIdx].copy(toggled = true)
Matias Reparaz
06/03/2020, 1:31 PMval elem = it.items.first { ..condition.. }
val list = (it.items - elem) + elem.copy(toggled = true)
Evan R.
06/03/2020, 2:31 PMtoMutableList()
also makes a copy of the original list. You should define the original list as mutable if you want to mutate it.