I want to combine two item list by sum of items group by it's count. object definition:Item (name:String, count:Long}
var list1 : MutableList<Item> = //From API 1 call
var list2 : MutableList<Item>= //From API 2 call
Example:
Item 1: [{"pen",2}, {"pencil", 3}]
Item 2: [{"pen",6}, {"chair", 2}]
Output like:
Final list: [{"pen",8}, {"pencil", 3}, {"chair", 2}]
How do I achieve in kotlin using any collection inbuilt function?