ilya.gorbunov
10/15/2017, 7:36 PMfun <F,S,K> setPartition(
first: Iterable<F>,
second: Iterable<S>,
firstGetKey: F.() -> K,
secondGetKey: S.() -> K
): List<Triple<K, F?, S?>>
{
val firstByKey = first.associateBy(firstGetKey)
val secondByKey = second.associateBy(secondGetKey)
val allKeys = firstByKey.keys + secondByKey.keys
return allKeys.map { Triple(it, firstByKey[it], secondByKey[it]) }
}
dave08
10/16/2017, 2:13 AMilya.gorbunov
10/16/2017, 2:16 AMdave08
10/16/2017, 2:19 AMilya.gorbunov
10/16/2017, 2:22 AMdave08
10/16/2017, 2:24 AM