void () { addElement(new Object()); addElement(new Object()); Iterator<Object> iterator = myWeakList.iterator(); assertTrue(iterator.hasNext()); myHolder.clear(); gc(); assertNotNull(iterator.next()); assertFalse(iterator.hasNext()); }