org.hibernate.util
Class IdentityMap

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

public final class IdentityMap
extends java.lang.Object
implements java.util.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
java.util.Map.Entry<K,V>
 
Method Summary
 void clear()
           
static java.util.Map.Entry[] concurrentEntries(java.util.Map map)
          Return the map entries (as instances of Map.Entry in a collection that is safe from concurrent modification).
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object val)
           
static java.util.Map deserialize(java.lang.Object o)
          Workaround for a JDK 1.4.1 bug where IdentityHashMaps are not correctly deserialized.
static java.util.List entries(java.util.Map map)
           
 java.util.Map.Entry[] entryArray()
           
 java.util.List entryList()
           
 java.util.Set entrySet()
           
 java.lang.Object get(java.lang.Object key)
           
static java.util.Map instantiate(int size)
          Return a new instance of this class, with an undefined iteration order.
static java.util.Map instantiateSequenced(int size)
          Return a new instance of this class, with iteration order defined as the order in which entries were added
static java.util.Map invert(java.util.Map map)
           
 boolean isEmpty()
           
 java.util.Iterator keyIterator()
           
static java.util.Iterator keyIterator(java.util.Map map)
           
 java.util.Set keySet()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map otherMap)
           
 java.lang.Object remove(java.lang.Object key)
           
static java.lang.Object serialize(java.util.Map map)
          Workaround for a JDK 1.4.1 bug where IdentityHashMaps are not correctly deserialized.
 int size()
           
 java.lang.String toString()
           
 java.util.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 java.util.Map instantiate(int size)
Return a new instance of this class, with an undefined iteration order.

Parameters:
size - The size of the map
Returns:
Map

instantiateSequenced

public static java.util.Map instantiateSequenced(int size)
Return a new instance of this class, with iteration order defined as the order in which entries were added

Parameters:
size - The size of the map to create
Returns:

concurrentEntries

public static java.util.Map.Entry[] concurrentEntries(java.util.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 java.util.List entries(java.util.Map map)

keyIterator

public static java.util.Iterator keyIterator(java.util.Map map)

keyIterator

public java.util.Iterator keyIterator()

size

public int size()
Specified by:
size in interface java.util.Map

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object val)
Specified by:
containsValue in interface java.util.Map

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map

putAll

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

clear

public void clear()
Specified by:
clear in interface java.util.Map

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map

entryList

public java.util.List entryList()

entryArray

public java.util.Map.Entry[] entryArray()

serialize

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

Parameters:
map -
Returns:
Object

deserialize

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

Parameters:
o -
Returns:
Map

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

invert

public static java.util.Map invert(java.util.Map map)


Copyright © 2008 Hibernate.org. All Rights Reserved.