java - Group duplicates values into single hashmap -
using list<map<string, object>> have merge same groupname , product_attributes converted arrays. receiving below data in list<map<string, object>> data following method converts data private list<map<string, object>> mapdataforclient(list<map<string, object>> data, list<long> ids) { list<map<string,object>> list = new arraylist<>(); for(map<string, object> d: data) { map<string, object> group = new hashmap<>(); string groupname = (string) d.get("group_name"); group.put("groupname", groupname); string productid = (string) d.get("product_id"); string productattributetype = (string) d.get("product_attribute_type"); string productattributename = (string) d.get("product_attribute_name"); map<string, object> types = new hashmap<>();