Java Identity HashMap Tutorial with Example program



Class IdentityHashMap


Type Parameters:
K - the type of keys maintained by this map
V - the type of mapped values


All Implemented Interfaces:
    Serializable, Cloneable, Map

public class IdentityHashMap
extends AbstractMap
implements Map, Serializable, Cloneable
{
//
}

Since:
    1.4
   
See Also:
    System.identityHashCode(Object), Object.hashCode(), Collection, Map, HashMap, TreeMap, Serialized Form

Nested classes/interfaces inherited from class java.util.AbstractMap

AbstractMap.SimpleEntry, AbstractMap.SimpleImmutableEntry
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry


Constructors summary
IdentityHashMap()
    Constructs a new, empty identity hash map with a default expected maximum size (21).
   
IdentityHashMap(int expectedMaxSize)
    Constructs a new, empty map with the specified expected maximum size.

IdentityHashMap(Map m)
    Constructs a new identity hash map containing the keys-value mappings in the specified map.

Methods
summary

void clear()
    Removes all of the mappings from this map.
   
Object clone()
    Returns a shallow copy of this identity hash map: the keys and values themselves are not cloned.
   
boolean containsKey(Object key)
    Tests whether the specified object reference is a key in this identity hash map.
   
boolean containsValue(Object value)
    Tests whether the specified object reference is a value in this identity hash map.
   
Set entrySet()
    Returns a Set view of the mappings contained in this map.
   
boolean equals(Object o)
    Compares the specified object with this map for equality.
   
V get(Object key)
    Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
   
int hashCode()
    Returns the hash code value for this map.
   
boolean isEmpty()
    Returns true if this identity hash map contains no key-value mappings.
   
Set keySet()
    Returns an identity-based set view of the keys contained in this map.
   
V put(K key, V value)
    Associates the specified value with the specified key in this identity hash map.
   
void putAll(Map m)
    Copies all of the mappings from the specified map to this map.
   
V remove(Object key)
    Removes the mapping for this key from this map if present.
   
int size()
    Returns the number of key-value mappings in this identity hash map.
   
Collection values()
    Returns a Collection view of the values contained in this map.
   
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait,wait,toString


Related Post

Comments


©candidjava.com