josephivie
01/24/2019, 5:33 PMxenoterracide
01/24/2019, 5:49 PMhudsonb
01/24/2019, 5:52 PMhudsonb
01/24/2019, 5:52 PMjosephivie
01/24/2019, 7:58 PMkarelpeeters
01/24/2019, 9:03 PMWeakHashMap
has weak keys, isn't that exactly what you want?hudsonb
01/24/2019, 9:03 PMkarelpeeters
01/24/2019, 9:03 PMequals
problem of course.karelpeeters
01/24/2019, 9:03 PMhudsonb
01/24/2019, 9:08 PMHashMap
compares keys using equals
, an identity hashmap compares them by reference. To build a library on the JVM which allowed for extension fields, you'd probably need a static identity hashmap.hudsonb
01/24/2019, 9:09 PMkarelpeeters
01/24/2019, 9:10 PMkarelpeeters
01/24/2019, 9:10 PMhudsonb
01/24/2019, 9:11 PMhudsonb
01/24/2019, 9:11 PMkarelpeeters
01/24/2019, 9:11 PMMap
, great 😕hudsonb
01/24/2019, 9:12 PMjosephivie
01/24/2019, 11:24 PMWeakHashMap
only cleans itself up when you ask for its size or it needs to expand. That’s why you’d need to use PhantomReference.karelpeeters
01/24/2019, 11:27 PMjosephivie
01/25/2019, 12:41 AMjosephivie
01/25/2019, 12:44 AMexpungeStaleEntries
(a private function in WeakHashMap
) is called only under a couple of scenarios, which only happen sometimes.josephivie
01/25/2019, 12:46 AMxenoterracide
01/25/2019, 2:06 AMelizarov
01/25/2019, 8:24 AMBenoît
02/01/2019, 10:42 AMkarelpeeters
02/01/2019, 11:01 AMremoveWhen
call is bad 😞Benoît
02/01/2019, 11:28 AMkarelpeeters
02/01/2019, 11:29 AMWeakIdentityMap
and use that.Benoît
02/01/2019, 11:30 AMkarelpeeters
02/01/2019, 11:31 AMBenoît
02/01/2019, 11:35 AM