kd
03/01/2019, 9:21 PMtoList
method but it does not seem to work.
Context: I am trying to implement a simple recycler view and update it using DiffUtil, but the oldList and newList are the same for some reasonkarelpeeters
03/01/2019, 9:24 PM.toList()
makes a shallow copy, the elements aren't copied but the lists themselves are independant.kd
03/01/2019, 9:45 PMnkiesel
03/01/2019, 10:00 PMcopy
method for your class. This is not built-in because it's often situation-specific and generic solutions will not be able to handle recursive/self-referencing data structures. Having said that: list.map{it.copy()}
works if the list contains data class objects (which have a shallow copy method) and you can live with that.