- Java.util - WeakHashMap
- Java.util - Vector
- Java.util - UUID
- Java.util - TreeSet
- Java.util - TreeMap
- Java.util - TimeZone
- Java.util - TimerTask
- Java.util - Timer
- Java.util - StringTokenizer
- Java.util - Stack
- Java.util - SimpleTimeZone
- Java.util - ServiceLoader
- Java.util - Scanner
- Java.util - ResourceBundle.Control
- Java.util - ResourceBundle
- Java.util - Random
- Java.util - PropertyResourceBundle
- Java.util - PropertyPermission
- Java.util - Properties
- Java.util - PriorityQueue
- Java.util - Observable
- Java.util - Locale
- Java.util - ListResourceBundle
- Java.util - LinkedList
- Java.util - LinkedHashSet
- Java.util - LinkedHashMap
- Java.util - IdentityHashMap
- Java.util - Hashtable
- Java.util - HashSet
- Java.util - HashMap
- Java.util - GregorianCalendar
- Java.util - Formatter
- Java.util - EnumSet
- Java.util - EnumMap
- Java.util - Dictionary
- Java.util - Date
- Java.util - Currency
- Java.util - Collections
- Java.util - Calendar
- Java.util - BitSet
- Java.util - Arrays
- Java.util - ArrayList
- Java.util - ArrayDeque
- Java.util - Home
Java.util Package Extras
- Java.util - Discussion
- Java.util - Useful Resources
- Java.util - Enumerations
- Java.util - Exceptions
- Java.util - Interfaces
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java.util.IdentityHashMap Class
Introduction
The java.util.IdentityHashMap class implements the Map interface with a hash table, using reference-equapty in place of object-equapty when comparing keys (and values).Following are the important points about IdentityHashMap −
This class provides all of the optional map operations, and permits null values and the null key.
This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.
In an IdentityHashMap, two keys k1 and k2 are considered equal if and only if (k1==k2), while in Map implementations (pke HashMap) two keys k1 and k2 are considered equal if and only if (k1==null ? k2==null : k1.equals(k2)).
Class declaration
Following is the declaration for java.util.IdentityHashMap class −
pubpc class IdentityHashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>, Seriapzable, Cloneable
Class constructors
Sr.No. | Constructor & Description |
---|---|
1 | IdentityHashMap() This constructs a new, empty identity hash map with a default expected maximum size (21). |
2 | IdentityHashMap(int expectedMaxSize) This constructs a new, empty map with the specified expected maximum size. |
3 | IdentityHashMap(Map<? extends K,? extends V> m) This constructs a new identity hash map containing the keys-value mappings in the specified map. |
Class methods
Sr.No. | Method & Description |
---|---|
1 | This method removes all of the mappings from this map. |
2 | This method returns a shallow copy of this identity hash map: the keys and values themselves are not cloned. |
3 | This method tests whether the specified object reference is a key in this identity hash map. |
4 | This method tests whether the specified object reference is a value in this identity hash map. |
5 | This method returns a Set view of the mappings contained in this map. |
6 | This method compares the specified object with this map for equapty. |
7 | This method returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. |
8 | This method returns returns the hash code value for this map. |
9 | This method returns true if this identity hash map contains no key-value mappings. |
10 | This method returns an identity-based set view of the keys contained in this map. |
11 | This method associates the specified value with the specified key in this identity hash map. |
12 | This method copies all of the mappings from the specified map to this map. |
13 | This method removes the mapping for this key from this map if present. |
14 | This method returns the number of key-value mappings in this identity hash map. |
15 | This method returns returns a Collection view of the values contained in this map. |
Methods inherited
This class inherits methods from the following classes −
java.util.AbstractMap
java.util.Object