Code example for IdentityHashMap

Methods: put, remove, size

0
    /** 
     * @tests java.util.IdentityHashMapTest#remove(java.lang.Object) 
     */ 
    public void test_removeLjava_lang_Object() { 
        // Regression for HARMONY-37 
        IdentityHashMap<String, String> hashMap = new IdentityHashMap<String, String>();
        hashMap.remove("absent");
        assertEquals("Assert 0: Size is incorrect", 0, hashMap.size());
 
        hashMap.put("key", "value");
        hashMap.remove("key");
        assertEquals("Assert 1: After removing non-null element size is incorrect", 0, hashMap.size());
 
        hashMap.put(null, null);
        assertEquals("Assert 2: adding literal null failed", 1, hashMap.size());
        hashMap.remove(null);
        assertEquals("Assert 3: After removing null element size is incorrect", 0, hashMap.size());
    } 
 
	/** 
	 * @tests java.util.IdentityHashMap#entrySet() 
	 * @tests java.util.IdentityHashMap#keySet()