Code example for WeakHashMap

Methods: size

0
            Map.Entry entry = (Map.Entry) it.next();
            assertTrue("Invalid map entry returned--bad key", keys
                    .contains(entry.getKey()));
            assertTrue("Invalid map entry returned--bad key", values
                    .contains(entry.getValue()));
        } 
        keys = null;
        values = null;
        keyArray[50] = null;
 
        int count = 0;
        do { 
            System.gc();
            System.gc();
            Runtime.getRuntime().runFinalization();
            count++;
        } while (count <= 5 && entrySet.size() == 100);
 
        assertTrue(
                "Incorrect number of entries returned after gc--wanted 99, got: " 
                        + entrySet.size(), entrySet.size() == 99);