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.
Version:
- java util HashMap
- Stephen Colebourne
- Commons Collections 3.0
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.
map - the map to copy
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
- a shallow clone
createEntry
protected AbstractHashedMap.HashEntry createEntry(AbstractHashedMap.HashEntry next,
int hashCode,
Object key,
Object value) Creates an entry to store the data.
This implementation creates an IdentityEntry instance.
- createEntry in interface AbstractHashedMap
next - the next entry in sequencehashCode - the hash code to usekey - the key to storevalue - the value to store
- the newly created entry
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
- the hash code
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-2005 Apache Software Foundation. All Rights Reserved.