java map差集,并集

public static void getDifferenceSetByGuava(Map<String, Object> bigMap, Map<String, String> smallMap, Map<String, Object> resMap) {
    Set<String> bigMapKey = bigMap.keySet();
    Set<String> smallMapKey = smallMap.keySet();
    Set<String> differenceSet = Sets.difference(bigMapKey, smallMapKey);//差集
Set<String> differenceSet = Sets.union(bigMapKey, smallMapKey);//并集
for (String key : differenceSet)
{
resMap.put(key, bigMap.get(key)); }
}
posted @ 2022-07-27 09:48  cap_ys  阅读(389)  评论(0)    收藏  举报