diesieben07
08/01/2017, 3:08 PMval list = listOf("hello" to "world", "hello" to "world2", "bla" to "quz")
val result = list.groupingBy { it.first }.fold(null as String?) { acc, elem -> acc ?: elem.second }diesieben07
08/01/2017, 3:11 PMval list = listOf("hello" to "world", "hello" to "two worlds", "bla" to "quz")
val result = list.groupingBy { it.first }.aggregate { _, acc: String?, elem, _ -> acc ?: elem.second }iex
08/01/2017, 3:17 PMmap - similar to what you did with aggregateiex
08/01/2017, 3:17 PMgroupBySingle or similar to do it in one stepdiesieben07
08/01/2017, 3:18 PMgroupingBy is that it does not construct and intermediary Map<K, List<V>> for the grouping.diesieben07
08/01/2017, 3:18 PMiex
08/01/2017, 3:18 PMdiesieben07
08/01/2017, 3:19 PMgroupingBy like I showed in your extension function 😉iex
08/01/2017, 3:24 PM