MapUtil { @SafeVarargs public static <K, V> Map<K, V> buildIdentityHashMap(V... values) { Map<K, V> map = newIdentityHashMap(values.length); buildMap(map, values); return map; }  static Map<K, V> newHashMap(); static Map<K, V> newHashMap(int initialCapacity); static Map<K, V> newHashMap(int initialCapacity, float loadFactor); static Map<K, V> newHashMap(Map<? extends K, ? extends V> m); @SafeVarargs static Map<K, V> buildHashMap(V... values); @SuppressWarnings("rawtypes") static Class<? extends Map> getHashMapClass(); static Map<K, V> newLinkedHashMap(); static Map<K, V> newLinkedHashMap(int initialCapacity); static Map<K, V> newLinkedHashMap(Map<? extends K, ? extends V> m); @SafeVarargs static Map<K, V> buildLinkedHashMap(V... values); @SuppressWarnings("rawtypes") static Class<? extends Map> getLinkedHashMapClass(); static Map<K, V> newIdentityHashMap(); static Map<K, V> newIdentityHashMap(int initialCapacity); static Map<K, V> newIdentityHashMap(Map<? extends K, ? extends V> m); @SuppressWarnings("rawtypes") static Class<? extends Map> getIdentityHashMapClass(); @SafeVarargs static Map<K, V> buildIdentityHashMap(V... values); static TreeMap<K, V> newTreeMap(); static TreeMap<K, V> newTreeMap(Comparator<? super K> comparator); static TreeMap<K, V> newTreeMap(Map<? extends K, ? extends V> m); static TreeMap<K, V> newTreeMap(SortedMap<K, ? extends V> m); @SafeVarargs static TreeMap<K, V> buildTreeMap(V... values); @SuppressWarnings("rawtypes") static Class<? extends TreeMap> getTreeMapClass(); static Hashtable<K, V> newHashtable(); static Hashtable<K, V> newHashtable(int initialCapacity); static Hashtable<K, V> newHashtable(Map<? extends K, ? extends V> m); @SafeVarargs static Hashtable<K, V> buildHashtable(V... values); @SuppressWarnings("rawtypes") static Class<? extends Hashtable> getHashtableClass(); static Map<E, E> arrayToMap(E[][] array); static boolean isEmpty(Map<?, ?> map);  }
@Test public void testBuildIdentityHashMap() { testBuildMap(MapUtil.buildIdentityHashMap("a", 1, "b", 2)); }