### Question:
MapUtils { public static HashMap<Long, Integer> unionMaps(List<HashMap<Long, Integer>> table) { HashMap<Long, Integer> result = new HashMap<Long, Integer>(); for (HashMap<Long, Integer> hs : table) { for (Entry<Long, Integer> temp : hs.entrySet()) { if (result.get(temp.getKey()) == null) { result.put(temp.getKey(), temp.getValue()); } else { result.put(temp.getKey(), result.get(temp.getKey()) + temp.getValue()); } } } return result; }  static HashMap<String, String> tranToRatio(HashMap<Integer, Integer> table); static HashMap<Long, Integer> unionMaps(List<HashMap<Long, Integer>> table); static int getSum(HashMap<Long, Integer> table); static int[] getRealUses(HashMap<Long, Integer> table, int num); static String[] getRealRatio(HashMap<Long, Integer> table, int num); static int[] getRealCount(HashMap<Long, Integer> table, int num); static int getMaxKey(HashMap<Integer, String> map);  }### Answer:
@Test public void testUnionMaps() { List<HashMap<Long, Integer>> table = new ArrayList<HashMap<Long, Integer>>(); table.add(map1); table.add(map2); HashMap<Long, Integer> result = MapUtils.unionMaps(table); assertTrue(result.get(11L) == 12); assertTrue(result.get(22L) == 24); assertTrue(result.get(111L) == 122); }