void (ConcurrentLongObjectMap<Object> map) { map.clear(); int K1 = 1; map.put(K1, this); int K2 = 2; map.put(K2, map); assertEquals(2, ContainerUtil.collect(map.entries().iterator()).size()); assertEquals(2, ContainerUtil.collect(map.entries().iterator()).size()); Iterator<ConcurrentLongObjectMap.LongEntry<Object>> iterator = map.entries().iterator(); assertTrue(iterator.hasNext()); ConcurrentLongObjectMap.LongEntry<Object> next = iterator.next(); long key = next.getKey(); assertTrue(key==K1 || key==K2); iterator.remove(); assertEquals(1, ContainerUtil.collect(map.entries().iterator()).size()); Iterator<ConcurrentLongObjectMap.LongEntry<Object>> it2 = map.entries().iterator(); long otherKey = K1 + K2 - key; assertEquals(otherKey, it2.next().getKey()); assertFalse(it2.hasNext()); try { it2.next(); fail("must throw"); } catch (NoSuchElementException ignored) { } assertTrue(iterator.hasNext()); assertEquals(otherKey, iterator.next().getKey()); iterator.remove(); UsefulTestCase.assertEmpty(ContainerUtil.collect(map.entries().iterator())); assertTrue(map.isEmpty()); }