java.util.IdentityHashMap.equals() 方法


java.util.IdentityHashMap.equals() 方法

package com.codingdict;

import java.util.*;

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

      // create 2 identity hash maps
      IdentityHashMap ihmap1 = new IdentityHashMap();
      IdentityHashMap ihmap2 = new IdentityHashMap();

      // populate 2 maps
      ihmap1.put(1, "java");
      ihmap1.put(2, "util");
      ihmap1.put(3, "package");

      ihmap2.put(1, "java");
      ihmap2.put(2, "awt");
      ihmap2.put(3, "package");

      // compare 2 maps
      boolean isequal = ihmap1.equals(ihmap2);

      System.out.println("Is two maps equal: " + isequal);
   }    
}