<@U41021CCB> I'm guessing a regular map of weakref...
# tornadofx
p
@nimakro I'm guessing a regular map of weakreferences won't have it's key-value pair garbage collected when it's no longer referenced. It will keep the pairs, maybe pointing to nulls. Might be wrong though.
n
@pim Is that not just true if the key is not referenced anymore. If the value is garbage collected there are still nulls in the weakHashMap?
p
I have no experience with weak references, sorry 🙂
I'd think that if the value is GC, the key gets removed as well
"Storing only weak references allows a key-value pair to be garbage-collected when its key is no longer referenced outside of the WeakHashMap." Nevermind
👍 1
n
Yes that's what I thought and that's why I can't figure out what the benefit is of using the WeakHashMap since the keys are Strings
p
But are these strings referenced somewhere? Otherwise they would be GCd immediately
n
I guess so..