I would like a "symbol alphabet" to have a bi-directional map with weak/soft references. Something like an Apache's Common BidiMap
(or Guava's BiMap
) with a WeakMap
-like interface.
A solution would be to use BiMap<WeakReference<K>,V>
and once in a while clean-up entries, but it's not optimal. Any suggestions?