org.apache.commons.collections.map
Class IdentityMap
- Cloneable, Map, Serializable, IterableMap
public class IdentityMap
implements Serializable, Cloneable
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
java.util.Collections.synchronizedMap(Map). This class may throw
exceptions when accessed by concurrent threads without synchronization.
$Revision: 348007 $ $Date: 2005-11-21 22:52:57 +0000 (Mon, 21 Nov 2005) $- java util HashMap
- Stephen Colebourne
DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_THRESHOLD, GETKEY_INVALID, GETVALUE_INVALID, MAXIMUM_CAPACITY, NO_NEXT_ENTRY, NO_PREVIOUS_ENTRY, NULL, REMOVE_INVALID, SETVALUE_INVALID, data, entrySet, keySet, loadFactor, modCount, size, threshold, values |
IdentityMap()- Constructs a new empty map with default size and load factor.
|
IdentityMap(Map map)- Constructor copying elements from another map.
|
IdentityMap(int initialCapacity)- Constructs a new, empty map with the specified initial capacity.
|
IdentityMap(int initialCapacity, float loadFactor)- Constructs a new, empty map with the specified initial capacity and
load factor.
|
addEntry, addMapping, calculateNewCapacity, calculateThreshold, checkCapacity, clear, clone, containsKey, containsValue, convertKey, createEntry, createEntrySetIterator, createKeySetIterator, createValuesIterator, destroyEntry, doReadObject, doWriteObject, ensureCapacity, entryHashCode, entryKey, entryNext, entrySet, entryValue, equals, get, getEntry, hash, hashCode, hashIndex, init, isEmpty, isEqualKey, isEqualValue, keySet, mapIterator, put, putAll, remove, removeEntry, removeMapping, reuseEntry, size, toString, updateEntry, values |
IdentityMap
public IdentityMap()
Constructs a new empty map with default size and load factor.
IdentityMap
public IdentityMap(Map map)
Constructor copying elements from another map.
IdentityMap
public IdentityMap(int initialCapacity)
Constructs a new, empty map with the specified initial capacity.
initialCapacity - the initial capacity
IdentityMap
public IdentityMap(int initialCapacity,
float loadFactor) Constructs a new, empty map with the specified initial capacity and
load factor.
initialCapacity - the initial capacityloadFactor - the load factor
clone
public Object clone()
Clones the map without cloning the keys or values.
- clone in interface AbstractHashedMap
hash
protected int hash(Object key)
Gets the hash code for the key specified.
This implementation uses the identity hash code.
- hash in interface AbstractHashedMap
key - the key to get a hash code for
isEqualKey
protected boolean isEqualKey(Object key1,
Object key2) Compares two keys for equals.
This implementation uses ==.
- isEqualKey in interface AbstractHashedMap
key1 - the first key to comparekey2 - the second key to compare
- true if equal by identity
isEqualValue
protected boolean isEqualValue(Object value1,
Object value2) Compares two values for equals.
This implementation uses ==.
- isEqualValue in interface AbstractHashedMap
value1 - the first value to comparevalue2 - the second value to compare
- true if equal by identity
Copyright © 2001-2015 Apache Software Foundation. All Rights Reserved.