private static Hashtable<String, Integer> getEventCountMap(Hashtable<String, Integer> eventCountMap,
Hashtable<String, Integer> otherEventCountMap)
{
Hashtable<String, Integer> mergeEventCountMap = new Hashtable<String, Integer>();
mergeEventCountMap.putAll(eventCountMap);
Set<Entry<String, Integer>> entries = otherEventCountMap.entrySet();
for (Entry<String, Integer> entry : entries)
{
String key = entry.getKey();
Integer value = entry.getValue();
Integer oldValue = mergeEventCountMap.get(key);
if (oldValue != null)
{
value += oldValue;
}
mergeEventCountMap.put(key, value);
}
return mergeEventCountMap;
}
Merge two Hashtable<String, Integer>
最新推荐文章于 2021-02-12 10:13:55 发布