org.hibernate.util

Class IdentityMap

Implemented Interfaces:
Map

public final class IdentityMap
extends java.lang.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

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 as the order in which 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()

Method Details

clear

public void clear()

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

containsKey

public boolean containsKey(Object key)

containsValue

public boolean containsValue(Object val)

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

entries

public static List entries(Map map)

entryArray

public Map.Entry[] entryArray()

entryList

public List entryList()

entrySet

public Set entrySet()

get

public Object get(Object key)

instantiate

public static 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 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:

invert

public static Map invert(Map map)

isEmpty

public boolean isEmpty()

keyIterator

public Iterator keyIterator()

keyIterator

public static Iterator keyIterator(Map map)

keySet

public Set keySet()

put

public Object put(Object key,
                  Object value)

putAll

public void putAll(Map otherMap)

remove

public Object remove(Object key)

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

size

public int size()

toString

public String toString()

values

public Collection values()