void () { Map<String, Object> map = CollectionFactory.createConcurrentWeakValueMap(); Ref<Object> ref1 = Ref.create(new Object()); Ref<Object> ref2 = Ref.create(new Object()); map.put("a", ref1.get()); map.put("b", ref2.get()); GCWatcher.fromClearedRef(ref2).ensureCollected(); assertEquals(1, map.size()); GCWatcher.fromClearedRef(ref1).ensureCollected(); assertTrue(map.toString(), map.isEmpty()); }