我有一个List<Map<String,Object>>
[ {key1: object1a, key2: object2a, key3: object3a},
{key1: object1a, key2: object2a, key3: object3a},
{key1: object1b, key2: object2b, key3: object3b},
{key1: object1b, key2: object2b, key3: object3b},
...
]
我想按第三个值对其进行分组,以获得Map<String,List<Map<String,Object>>>
:
{ object3a: [ {key1: object1a, key2: object2a},
{key1: object1a, key2: object2a}
],
object3b: [ {key1: object1b, key2: object2b},
{key1: object1b, key2: object2b}
],
...
}
是否可以通过使用该Collectors.groupingBy?
方法,以及如何?