https://kotlinlang.org logo
Title
j

Joaquim Ley

07/25/2019, 1:16 PM
Hello I’ve been :google: for some time now and SO and couldn’t really find a reason for this: I have Room returning
Flowable<List<Model>>
— This
Model
is a data class (hence I would assume
equals()
works as expected). But for some reason I get multiple notifications on a db change (I’ve mapped it with
distinctUntilChanged()
) This question [1] is addressing the same but I’ve had no success with the suggestions, and the accepted answer is referencing exactly
Object.equals
, I’ve also tried [2] using the suggestion as the distinct predicate, but with no success Thank you in advance for your time --- [1] https://stackoverflow.com/questions/48585491/room-flowable-invokes-multiple-times [2] https://stackoverflow.com/questions/35272761/how-to-compare-two-arrays-in-kotlin/48769967#48769967
j

jw

07/25/2019, 1:23 PM
Does it have a primitive array? If so, you need a custom equals and hashCode that uses contentEquals and contentHashCode on those properties for value equivalence to work.
j

Joaquim Ley

07/25/2019, 1:33 PM
Thanks for the suggestion and time, gonna try it