mergingFold

inline fun <K, V1, V2, R> mergingFold(map1: Map<out K, V1>, map2: Map<out K, V2>, initial: R, operation1: (acc: R, Map.Entry<K, V1>) -> R, operation2: (acc: R, Map.Entry<K, V2>) -> R, operationMerge: (acc: R, key: K, value1: V1, value2: V2) -> R): R

Accumulates value starting with initial value and applying operation1 to current accumulator value and each entry of map1 which key does not appear in map2, operation2 to current accumulator value and each entry of map2 which key does not appear in map2, and operationMerge to current accumulator value and triple of a common key of the maps and both its corresponding values in map1 and map2.

Parameters

map1

the first map to fold with another.

map2

the second map to fold with another.

initial

initial value of the accumulation.

operation1

function that takes current accumulator value and an entry of the map1 which key does not appear in map2 and calculates the next accumulator value.

operation2

function that takes current accumulator value and an entry of the map2 which key does not appear in map1 and calculates the next accumulator value.

operationMerge

function that takes current accumulator value and triple (key, value1, value2) where key=value1 is an entry of map1 and key=value2 is an entry of map2 and calculates the next accumulator value.