Online Java Compiler By
JavaTpoint.com
import java.util.IdentityHashMap; public class IdentityHashMapContainsValueExample1 { public static void main(String[] args) { //Creating an object of IdentityHashMap class IdentityHashMap
map = new IdentityHashMap
(6); //Putting key-value pairs inside map map.put("Java", 1); map.put("is", 2); map.put("the", 3); map.put("best", 4); map.put("programming", 5); map.put("language", 6); //Creating an Object int i1 = 1; double i2 = 1.0; int i3 = 4; int i4 = 8; //Checking if the specified key is present in the callinh IdentityHashMap System.out.println(map.containsValue(i1)); System.out.println(map.containsValue(i2)); System.out.println(map.containsValue(i3)); System.out.println(map.containsValue(i4)); } }
Output