This week's giveaway is in the Java/Jakarta EE forum. We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line! See When an object is only reachable through Weak reference (which means object is neither strongly reachable nor softly reachable), then it becomes eligible for GC. During the run of GC, this object will be marked and garbage collected.
In case of WeakHashMap, keys are referenced through Weak references. When a key is not being used or it is not strongly reachable, then in next run of GC, these keys will be garbage collected and hence mapping entry will be removed from the hashmap.