Sorry, but I don't agree. Anyone else? On 20.07.2007 14:01:52 Andreas L Delmelle wrote: > On Jul 20, 2007, at 11:58, Jeremias Maerki wrote: > > > > > Read again: "Implementation note: The value objects in a > > WeakHashMap are > > held by ordinary strong references." That means that all the object in > > there can never be released since there never be only a weak reference > > to the object there. > > Right, but the value objects are not the issue. As long as the key > can be released, and the value does not refer directly or indirectly > back to the key, there is no problem. What the Javadoc warns about is > the situation where value /refers back/ to the key in some way or > other: most simple case would be that the value object is composite > and has an instance member that is itself the key object. In that > case, the entry will never be released, unless the value itself is > wrapped in a WeakReference. > > FWIW: I had the same initial reservations, but re-reading the > Javadoc, it occurred to me that this was actually no problem at all. > > > Cheers > > Andreas
Jeremias Maerki