IdentityHashMap.putAll(Map <? extends K ,? extends V > m) has the following syntax.
public void putAll(Map <? extends K ,? extends V > m)
In the following code shows how to use IdentityHashMap.putAll(Map <? extends K ,? extends V > m) method.
// w ww . ja v a 2 s.c om import java.util.IdentityHashMap; public class Main { public static void main(String args[]) { IdentityHashMap<Integer,String> ihmap1 = new IdentityHashMap<Integer,String>(); IdentityHashMap<Integer,String> ihmap2 = new IdentityHashMap<Integer,String>(); // populate the ihmap1 ihmap1.put(1, "from"); ihmap1.put(2, "java2s.com"); ihmap1.put(3, "tutorial"); System.out.println("Value of ihmap1 before: " + ihmap1); System.out.println("Value of ihmap2 before: " + ihmap2); // put all values from ihmap1 to ihmap2 ihmap2.putAll(ihmap1); System.out.println("Value of ihmap2 after: " + ihmap2); } }
The code above generates the following result.