Hullaballoonatic
11/22/2019, 10:57 PMfoo
into bar
?
val foo = listOf(
'a' to 1,
'a' to 2,
'b' to 3
)
val bar = mapOf(
'a' to listOf(1, 2),
'b' to listOf(3)
)
UPDATE: I found the answer
fun <T, K, V> Iterable<T>.groupBy(
keySelector: (T) -> K,
valueTransform: (T) -> V
): Map<K, List<V>>
Andy Gibel
11/22/2019, 10:58 PMHullaballoonatic
11/22/2019, 11:00 PMMap<Char, Int>
instead of the desired Map<Char, List<Int>>
Dominaezzz
11/22/2019, 11:01 PMfoo.groupBy { it.first }
?Hullaballoonatic
11/22/2019, 11:03 PMMap<Char, List<Pair<Char, Int>>>
Hullaballoonatic
11/22/2019, 11:04 PMHullaballoonatic
11/22/2019, 11:04 PMHullaballoonatic
11/22/2019, 11:05 PMfoo.groupBy({ it.first }, { it.second })
Andy Gibel
11/22/2019, 11:07 PMAndy Gibel
11/22/2019, 11:07 PMreduce
lol