I need a Map implementation that shares properties of both IdentityHashMap and WeakHashMap (reference equality instead of equals() and weak references on keys).
What implementation do you recommend (it has to work on Android)?
I need a Map implementation that shares properties of both IdentityHashMap and WeakHashMap (reference equality instead of equals() and weak references on keys).
What implementation do you recommend (it has to work on Android)?
Copyright © 2021 Jogjafile Inc.
If you're suggesting Guava, then
new MapMaker().weakKeys().makeMap()would do the job directly, sinceweakKeysuses reference equality for keys.The documentation of
weakKeyssays: