BenchmarkUtils { public static void putIfAbsent(Map map, Object key, Object val) { if (!map.containsKey(key)) { map.put(key, val); } } private  BenchmarkUtils(); static double max(Iterable<Double> iterable); static double avg(Iterable<Double> iterable); static void putIfAbsent(Map map, Object key, Object val); static int getInt(Map map, Object key, int def); static boolean ifAckEnabled(Config config);  }
@Test public void testPutIfAbsent() { Map<String, Integer> map = Maps.newHashMap(); BenchmarkUtils.putIfAbsent(map, "key1", 1); assertThat(map.get("key1")).isEqualTo(1); BenchmarkUtils.putIfAbsent(map, "key1", 2); assertThat(map.get("key1")).isEqualTo(1); BenchmarkUtils.putIfAbsent(map, "key2", 3); assertThat(map.get("key2")).isEqualTo(3); }