Code example for IdentityHashMap

Methods: get, remove, size

0
     * java.util.IdentityHashMap#remove(java.lang.Object) 
     */ 
    public void test_removeLjava_lang_Object() { 
        // Test for method java.lang.Object 
        // java.util.IdentityHashMap.remove(java.lang.Object) 
        int size = hm.size();
        Integer x = ((Integer) hm.remove(objArray2[9]));
        assertTrue("Remove returned incorrect value", x.equals(new Integer(9)));
        assertNull("Failed to remove given key", hm.get(objArray2[9]));
        assertTrue("Failed to decrement size", hm.size() == (size - 1));
        assertNull("Remove of non-existent key returned non-null", hm
                .remove("LCLCLC"));
 
        IdentityHashMap m = new IdentityHashMap();
        m.put(null, "test");
        assertNull("Failed with same hash as null",
                m.remove(objArray[0]));
        assertEquals("Failed with null key", "test", m.remove(null));
    } 
 
    /**