java.util.IdentityHashMap.clone() 方法


java.util.IdentityHashMap.clone() 方法

package com.codingdict;

import java.util.*;

public class IdentityHashMapDemo {
   public static void main(String args[]) {

      // create two identity hash maps
      IdentityHashMap ihmap = new IdentityHashMap();
      IdentityHashMap ihmapclone = new IdentityHashMap();

      // populate the 1st map
      ihmap.put(1, "java");
      ihmap.put(2, "util");
      ihmap.put(3, "package");

      System.out.println("Initial Map content: " + ihmap);

      // clone the map
      ihmapclone = (IdentityHashMap)ihmap.clone();

      System.out.println("Cloned map content: " + ihmapclone);
   }    
}