Online Java Compiler By
JavaTpoint.com
import java.util.IdentityHashMap; public class IdentityHashMapValuesExample1 { 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(1, "Java"); map1.put(2, "is"); map1.put(3, "the"); map1.put(4, "best"); map1.put(5, "programming"); map1.put(6, "language"); //Displaying size of map1 System.out.println(map1.size()); //Displaying elements of map1 System.out.println(map1); //Displaying a collection of all the values System.out.println(map1.values()); } }
Output