spand
01/12/2022, 4:28 PMfun <K, V> Iterable<Map<K, V>>.merge(): Map<K, V>
that I am missing ?jw
01/12/2022, 4:33 PMephemient
01/12/2022, 4:41 PMfun <K, V> Iterable<Map<K, V>>.merge(): Map<K, V> = buildMap {
for (map in this@merge) putAll(map)
}
which won't have the O(N^2) behavior that fold(::plus)
willephemient
01/12/2022, 4:44 PM.asSequence().flatMap { it.entries }.associateBy({ it.key }, { it.value })
would also workspand
01/13/2022, 6:23 AM