Weakhashmap allow its entries to be garbage collected rather than waiting for full hashmap to be unused. So, it will automatically remove individual values when its key is no longer in ordinary use.
It can be used to prevent memory leak, where hashmap never reclaimed as one or more keys are still in use, even if maximum are not, like user data etc...