java.util.IdentityHashMap.entrySet() Method
Advertisements
Description
The entrySet() method is used to get a set view of the mappings contained in this map.
Declaration
Following is the declaration for java.util.IdentityHashMap.entrySet() method.
public Set<Map.Entry<K,V>> entrySet()
Parameters
NA
Return Value
The method call returns a set view of the identity-mappings contained in this map.
Exception
NA
Example
The following example shows the usage of java.util.IdentityHashMap.entrySet()
package com.tutorialspoint;
import java.util.*;
public class IdentityHashMapDemo {
public static void main(String args[]) {
// create identity hash map
IdentityHashMap ihmap = new IdentityHashMap();
// populate the map
ihmap.put(1, "java");
ihmap.put(2, "util");
ihmap.put(3, "package");
// create entry set from the map
Set enset=ihmap.entrySet();
System.out.println("Set view of the map: " + enset);
}
}
Let us compile and run the above program, this will produce the following result.
Set view of the map: [1=java, 3=package, 2=util]