Code example for IdentityHashMap

Methods: containsKeycontainsValuegetputremove

0
	/** 
	 * @tests java.util.IdentityHashMap#remove(java.lang.Object) 
	 * @tests java.util.IdentityHashMap#keySet() 
	 */ 
	public void test_remove() { 
		IdentityHashMap map = new IdentityHashMap();
		map.put(null, null);
		map.put("key1", "value1");
		map.put("key2", "value2");
		map.remove("key1");
 
		assertTrue("Did not remove key1", !map.containsKey("key1"));
		assertTrue("Did not remove the value for key1", !map
				.containsValue("value1"));
 
		assertTrue("Modified key2", map.get("key2") != null
				&& map.get("key2") == "value2");
		assertNull("Modified null entry", map.get(null));
	} 
 
    /** 
     * @tests java.util.IdentityHashMapTest#remove(java.lang.Object) 
     */ 
Stop searching for code, let great code find you!  Add Codota to your java IDE