Skip to main content

combineByKey (Function)

Function returns the map after combining all the maps given as parameters, such that the keys, of all the maps will be matched with an Array list of values from each map respectively.

Syntax

<OBJECT> map:combineByKey(<OBJECT> map, <OBJECT> map)
<OBJECT> map:combineByKey(<OBJECT> map, <OBJECT> map, <OBJECT> ...)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
mapThe map into which the key-values need to copied.OBJECTNoYes

Example 1

map:combineByKey(map1, map2)

If map2 contains key-value pairs (symbol: gdn), (volume :100), and if map2 contains key-value pairs (symbol: IBM),(price : 12), then the function returns the map with key value pairs as follows, (symbol: ArrayList(gdn, IBM)), (volume: ArrayList(100, null)) and (price: ArrayList(null, 12))