使用groupingBy:看看javadoc,但在你的情况下它应该是这样的:
a.flatMap(map -> map.entrySet().stream()) .collect( Collectors.groupingBy( Map.Entry::getKey, HashMap::new, Collectors.mapping(Map.Entry::getValue, toList()) ) );
要么:
a.map(Map::entrySet).flatMap(Set::stream) .collect(Collectors.groupingBy( Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, toList()) ) );