distinctConsecutiveBy

inline fun <T, K> Iterable<T>.distinctConsecutiveBy(crossinline selector: (T) -> K): List<T>

Returns a list without consecutive elements which have the same return by the given selector function.

Receiver

the base list for which the consecutive duplicates according to the selector are being removed

Return

list without consecutive duplicates

Parameters

selector

if the resulting elements of the selector is equal, the duplicates are being removed