Methods Summary |
---|
public void | clear()
dirty = true;
entryArray = null;
map.clear();
|
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().
return ( (IdentityMap) map ).entryArray();
|
public boolean | containsKey(java.lang.Object key)
IdentityKey k = new IdentityKey(key);
return map.containsKey(k);
|
public boolean | containsValue(java.lang.Object val)
return map.containsValue(val);
|
public static java.util.Map | deserialize(java.lang.Object o)Workaround for a JDK 1.4.1 bug where IdentityHashMaps are not
correctly deserialized.
return new IdentityMap( (Map) o );
|
public static java.util.List | entries(java.util.Map map)
return ( (IdentityMap) map ).entryList();
|
public java.util.Map$Entry[] | entryArray()
if (dirty) {
entryArray = new Map.Entry[ map.size() ];
Iterator iter = map.entrySet().iterator();
int i=0;
while ( iter.hasNext() ) {
Map.Entry me = (Map.Entry) iter.next();
entryArray[i++] = new IdentityMapEntry( ( (IdentityKey) me.getKey() ).key, me.getValue() );
}
dirty = false;
}
return entryArray;
|
public java.util.List | entryList()
ArrayList list = new ArrayList( map.size() );
Iterator iter = map.entrySet().iterator();
while ( iter.hasNext() ) {
Map.Entry me = (Map.Entry) iter.next();
list.add( new IdentityMapEntry( ( (IdentityKey) me.getKey() ).key, me.getValue() ) );
}
return list;
|
public java.util.Set | entrySet()
Set set = new HashSet( map.size() );
Iterator iter = map.entrySet().iterator();
while ( iter.hasNext() ) {
Map.Entry me = (Map.Entry) iter.next();
set.add( new IdentityMapEntry( ( (IdentityKey) me.getKey() ).key, me.getValue() ) );
}
return set;
|
public java.lang.Object | get(java.lang.Object key)
IdentityKey k = new IdentityKey(key);
return map.get(k);
|
public static java.util.Map | instantiate(int size)Return a new instance of this class, with an undefined
iteration order
return new IdentityMap( new HashMap(size) );
|
public static java.util.Map | instantiateSequenced(int size)Return a new instance of this class, with iteration
order defined by the order that entries were added
return new IdentityMap( new SequencedHashMap(size) );
|
public static java.util.Map | invert(java.util.Map map)
Map result = instantiate( map.size() );
Iterator iter = map.entrySet().iterator();
while ( iter.hasNext() ) {
Map.Entry me = (Map.Entry) iter.next();
result.put( me.getValue(), me.getKey() );
}
return result;
|
public boolean | isEmpty()
return map.isEmpty();
|
public static java.util.Iterator | keyIterator(java.util.Map map)
return ( (IdentityMap) map ).keyIterator();
|
public java.util.Iterator | keyIterator()
return new KeyIterator( map.keySet().iterator() );
|
public java.util.Set | keySet()
// would need an IdentitySet for this!
throw new UnsupportedOperationException();
|
public java.lang.Object | put(java.lang.Object key, java.lang.Object value)
dirty = true;
return map.put( new IdentityKey(key), value );
|
public void | putAll(java.util.Map otherMap)
Iterator iter = otherMap.entrySet().iterator();
while ( iter.hasNext() ) {
Map.Entry me = (Map.Entry) iter.next();
put( me.getKey(), me.getValue() );
}
|
public java.lang.Object | remove(java.lang.Object key)
dirty = true;
IdentityKey k = new IdentityKey(key);
return map.remove(k);
|
public static java.lang.Object | serialize(java.util.Map map)Workaround for a JDK 1.4.1 bug where IdentityHashMaps are not
correctly deserialized.
return ( (IdentityMap) map ).map;
|
public int | size()
return map.size();
|
public java.lang.String | toString()
return map.toString();
|
public java.util.Collection | values()
return map.values();
|