IdentityHashMap class

 

see Map interface  for descriptions and examples of IdentityHashMap's methods. 

 

■ A regular HashMap does not allow duplicate key names. If you need to allow for duplicate key names, use an identityHashMap instead. 

 

■ What identityHashMap does during key comparisons is to use = = (which checks the key's reference) instead of .equals( ) (which checks the key's content).  HashMap uses .equals( ) and that's why you can't have duplicate key names with it.

 

■ Except for the duplicate key issue, IdentityHashMap and its methods are the same as HashMap.

 

■ Duplicate values are allowed by both classes.