Next question: What is a strong reference?
Interesting hack: If you want to control whether an entry can be auto removed, reference the key in the value to hold it in the map until you're okay letting it get garbage collected, at which point you can invite a method on the value to drop the reference to the key.
How can i get the cup like yours.
But using it with Integer as the key, like in the example, also looks weird as a use case for WeakHashMap Not only because -128 to 127 is cached anyway (and thus will not be garbage collected) - but again regarding garbage collecting when the keys are no longer in use
Why does documentation says to use SoftReference for memory sensitive caches, and WeakReference is better for other applications (mapping) because it can be collected earlier.
Supports in java 8?
Is it safe in multi threading code?
Yeah, this map is very weak. The main use case is caching, but it implementation demands synchronisation. That makes is a bad choice for most use cases. Could cry every time I see this thing.
I don't like the coffee drinking bit. The coffee mug distracts from the main point.
@dispatch-indirect9206