org.hibernate.util
Class IdentityMap

java.lang.Object
  extended by org.hibernate.util.IdentityMap
All Implemented Interfaces:
Map

public final class IdentityMap
extends Object
implements Map

A Map where keys are compared by object identity, rather than equals().


Nested Class Summary
static class IdentityMap.IdentityKey
           
static class IdentityMap.IdentityMapEntry
           
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
 void clear()
           
static Map.Entry[] concurrentEntries(Map map)
          Return the map entries (as instances of Map.Entry in a collection that is safe from concurrent modification).
 boolean containsKey(Object key)
           
 boolean containsValue(Object val)
           
static Map deserialize(Object o)
          Workaround for a JDK 1.4.1 bug where IdentityHashMaps are not correctly deserialized.
static List entries(Map map)
           
 Map.Entry[] entryArray()
           
 List entryList()
           
 Set entrySet()
           
 Object get(Object key)
           
static Map instantiate(int size)
          Return a new instance of this class, with an undefined iteration order
static Map instantiateSequenced(int size)
          Return a new instance of this class, with iteration order defined by the order that entries were added
static Map invert(Map map)
           
 boolean isEmpty()
           
 Iterator keyIterator()
           
static Iterator keyIterator(Map map)
           
 Set keySet()
           
 Object put(Object key, Object value)
           
 void putAll(Map otherMap)
           
 Object remove(Object key)
           
static Object serialize(Map map)
          Workaround for a JDK 1.4.1 bug where IdentityHashMaps are not correctly deserialized.
 int size()
           
 String toString()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Method Detail

instantiate

public static Map instantiate(int size)
Return a new instance of this class, with an undefined iteration order

Returns:
Map

instantiateSequenced

public static Map instantiateSequenced(int size)
Return a new instance of this class, with iteration order defined by the order that entries were added


concurrentEntries

public static Map.Entry[] concurrentEntries(Map map)
Return the map entries (as instances of Map.Entry in a collection that is safe from concurrent modification). ie. we may safely add new instances to the underlying Map during iteration of the entries().

Parameters:
map -
Returns:
Collection

entries

public static List entries(Map map)

keyIterator

public static Iterator keyIterator(Map map)

keyIterator

public Iterator keyIterator()

size

public int size()
Specified by:
size in interface Map

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map

containsValue

public boolean containsValue(Object val)
Specified by:
containsValue in interface Map

get

public Object get(Object key)
Specified by:
get in interface Map

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map

remove

public Object remove(Object key)
Specified by:
remove in interface Map

putAll

public void putAll(Map otherMap)
Specified by:
putAll in interface Map

clear

public void clear()
Specified by:
clear in interface Map

keySet

public Set keySet()
Specified by:
keySet in interface Map

values

public Collection values()
Specified by:
values in interface Map

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

entryList

public List entryList()

entryArray

public Map.Entry[] entryArray()

serialize

public static Object serialize(Map map)
Workaround for a JDK 1.4.1 bug where IdentityHashMaps are not correctly deserialized.

Parameters:
map -
Returns:
Object

deserialize

public static Map deserialize(Object o)
Workaround for a JDK 1.4.1 bug where IdentityHashMaps are not correctly deserialized.

Parameters:
o -
Returns:
Map

toString

public String toString()
Overrides:
toString in class Object

invert

public static Map invert(Map map)