distinctUntilChangedBy() works a lot like
out equivalent items and only emitting the first of those equivalents. The
difference is that
distinctUntilChangedBy() takes a "key selector" lambda expression
or other function type. This lambda expression is responsible for returning
the object that should be used (via
== comparisons) to determine what items
are equivalent or not.
In this case, our flow is of a series of pairs, and the key selector lambda
first() piece of the
Pair — in this case, that is the
distinctUntilChangedBy() then ignores
Pair objects with
Int values, so only the first of our three
objects is emitted.
You can learn more about this in: