IdentityHashMap containsKey Example
IdentityHashMap class containsKey example. This example shows you how to use containsKey method.
IdentityHashMap class containsKey example.
Here is the code
/**
* @ # ContainsKey.java
* A class repersenting use to containsKey method
* of IdentityHashMap class in java.util package
* version 26 May 2008
* author Rose India
*/
import java.util.*;
public class ContainsKey {
public static void main(String args[]) {
IdentityHashMap map = new IdentityHashMap();
//Add the mapping into the map
map.put(1, "A");
map.put(2, "A");
map.put(3, "B");
System.out.println("Map " + map);
//Tests whether the specified object reference
//is a key in this identity hash map.
System.out.println(map.containsKey(1));
}
} |
|