java.lang.Object | |||
↳ | java.util.AbstractMap<K, V> | ||
↳ | org.apache.commons.collections.map.AbstractHashedMap | ||
↳ | org.apache.commons.collections.map.IdentityMap |
A Map
implementation that matches keys and values based
on ==
not equals()
.
This map will violate the detail of various Map and map view contracts. As a general rule, don't compare this map to other maps.
Note that IdentityMap is not synchronized and is not thread-safe.
If you wish to use this map from multiple threads concurrently, you must use
appropriate synchronization. The simplest approach is to wrap this map
using synchronizedMap(Map)
. This class may throw
exceptions when accessed by concurrent threads without synchronization.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
IdentityMap.IdentityEntry | HashEntry |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.commons.collections.map.AbstractHashedMap
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.commons.collections.map.AbstractHashedMap
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new empty map with default size and load factor.
| |||||||||||
Constructs a new, empty map with the specified initial capacity.
| |||||||||||
Constructs a new, empty map with the specified initial capacity and
load factor.
| |||||||||||
Constructor copying elements from another map.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Clones the map without cloning the keys or values.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates an entry to store the data.
| |||||||||||
Gets the hash code for the key specified.
| |||||||||||
Compares two keys for equals.
| |||||||||||
Compares two values for equals.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.commons.collections.map.AbstractHashedMap
| |||||||||||
From class
java.util.AbstractMap
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.util.Map
| |||||||||||
From interface
org.apache.commons.collections.IterableMap
|
Constructs a new empty map with default size and load factor.
Constructs a new, empty map with the specified initial capacity.
initialCapacity | the initial capacity |
---|
IllegalArgumentException | if the initial capacity is less than one |
---|
Constructs a new, empty map with the specified initial capacity and load factor.
initialCapacity | the initial capacity |
---|---|
loadFactor | the load factor |
IllegalArgumentException | if the initial capacity is less than one |
---|---|
IllegalArgumentException | if the load factor is less than zero |
Constructor copying elements from another map.
map | the map to copy |
---|
NullPointerException | if the map is null |
---|
Creates an entry to store the data. This implementation creates an IdentityEntry instance.
next | the next entry in sequence |
---|---|
hashCode | the hash code to use |
key | the key to store |
value | the value to store |
Gets the hash code for the key specified. This implementation uses the identity hash code.
key | the key to get a hash code for |
---|
Compares two keys for equals.
This implementation uses ==
.
key1 | the first key to compare |
---|---|
key2 | the second key to compare |
Compares two values for equals.
This implementation uses ==
.
value1 | the first value to compare |
---|---|
value2 | the second value to compare |