Code example for IdentityHashMap

Methods: getremovesize

	 * @tests 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
		IdentityHashMap m = new IdentityHashMap();
		m.put(null, "test");
		assertNull("Failed with same hash as null",
		assertEquals("Failed with null key", "test", m.remove(null));
Experience pair programming with AI  Get Codota for Java