### Question:
SetUtils { public static <K1, K2> Set<K2> getNestedSet(K1 key, ConcurrentMap<K1, Set<K2>> set) { Set<K2> inner = set.get(key); if (inner == null) { inner = Collections.newSetFromMap(new ConcurrentHashMap<K2, Boolean>()); Set<K2> old = set.putIfAbsent(key, inner); if (old != null) inner = old; } return inner; }  static Set<K2> getNestedSet(K1 key, ConcurrentMap<K1, Set<K2>> set);  }### Answer:
@Test public void testGetNestedSet() { concurrentMap.put(key, nestedSet); Set<Object> inner = SetUtils.getNestedSet(key, concurrentMap); assertEquals(nestedSet, inner); }
@Test public void testGetNestedSet_InnerNull() { Set<Object> inner = SetUtils.getNestedSet(key, concurrentMap); assertTrue(inner.isEmpty()); }