myanmarking
04/26/2018, 10:56 AMpublic inline fun <T, K> Iterable<T>.distinctLatestBy(selector: (T) -> K): List<T> {
val set = HashMap<K, T>()
for (e in this) {
val key = selector(e)
set[key] = e
}
return ArrayList(set.values)
}