Online Java Compiler By
JavaTpoint.com
import java.util.IdentityHashMap; public class IdentityHashMapIsEmptyExample1 { public static void main(String[] args) { //Creating an object of IdentityHashMap class IdentityHashMap
map1 = new IdentityHashMap
(6); //Creating another object of IdentityHashMap IdentityHashMap
map2 = new IdentityHashMap
(); //Putting key-value pairs inside map map1.put("Java", 1); map1.put("is", 2); map1.put("the", 3); map1.put("best", 4); map1.put("programming", 5); map1.put("language", 6); //Checking whether the map1 and map2 IdentityHashMap is empty or not System.out.println(map1.isEmpty()); System.out.println(map2.isEmpty()); } }
Output