Online Java Compiler By
JavaTpoint.com
import java.util.IdentityHashMap; public class IdentityHashMapRemoveExample1 { public static void main(String[] args) { //Creating an object of IdentityHashMap class IdentityHashMap
map1 = new IdentityHashMap
(6); //Putting key-value pairs inside map1 map1.put("Java", 1); map1.put("is", 2); map1.put("the", 3); map1.put("best", 4); map1.put("programming", 5); map1.put("language", 6); //Displaying elements of map1 System.out.println(map1); //Removing some linkage from the map System.out.println(map1.remove("the")); System.out.println(map1.remove("best")); //Displaying elements of map1 after removing some elements System.out.println(map1); } }
Output