Hello. What function can find the difference betwe...
# announcements
n
Hello. What function can find the difference between collections of objects by ID? Example:
Copy code
val list1 = listOf(ExampleObject(id = 1), ExampleObject(id = 2))
val list2 = listOf(ExampleObject(id = 2))

Result: listOf(ExampleObject(1))
Thanks in advance.
a
I think there is a minus function
n
Yes, but it isn’t compares by fields
b
You could union the list and distinctBy possibly
There is an operator that's the opposite of union just not recalling it's name
a
intersect