A weak identity hash map would be faster and more useful than the existing
weak hash map. The ThreadLocal mechanism shows how well it can be implemented
(very fast in 1.4) and how useful it can be. I have a similar need but I don't
want to spawn threads just to get the effect. What I really need is a
Name: rmT116609 Date: 01/29/2003
A DESCRIPTION OF THE PROBLEM :
In JDK1.4, we have
* IdentityHashMap: Which ignores hashCode() for the keys and always uses identityHashCode().
* WeakHashMap - which allows "non-intrusive object extension". The Javadoc says:
"This class is intended primarily for use with key objects whose equals methods test for object identity using the == operator".
However, if you have objects which do *not* test like this (e.g. all Collections!), you are out of luck (with the predefined classes).
It would make much sense to also provide a WeakIdentityHashMap which could be used with all keys according to the WeakHashMap documentation.
CUSTOMER WORKAROUND :
Implement your own IdentityWeakHashMap; you cannot use WeakHashMap or IdentityHashMap there - so you must start at a pretty basic level ...
(Review ID: 180535)