Java IdentityHashMap.remove(Object key)
Syntax
IdentityHashMap.remove(Object key) has the following syntax.
public V remove(Object key)
Example
In the following code shows how to use IdentityHashMap.remove(Object key) method.
//ww w . j a va 2 s. c om
import java.util.IdentityHashMap;
public class Main {
public static void main(String args[]) {
IdentityHashMap<Integer,String> ihmap = new IdentityHashMap<Integer,String>();
ihmap.put(1, "from");
ihmap.put(2, "java2s.com");
ihmap.put(3, "tutorial");
System.out.println("Value of ihmap before: " + ihmap);
// remove element at key 2
ihmap.remove(2);
System.out.println("Value of ihmap after remove: " + ihmap);
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »