Merge values in map kotlin

前端 未结 11 1522
慢半拍i
慢半拍i 2021-02-18 23:50

I need merge maps mapA andmapB with pairs of \"name\" - \"phone number\" into the final map, sticking together the values for duplicate keys, separated

11条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-18 23:55

    (mapA.data.asSequence() + mapB.asSequence())
       .map { Pair(it.key, it.value) }
       .toMap()
    

提交回复
热议问题