Michael Heuer wrote:
Might you also be able to use an unmutable MultiKey for storage in the
hashed map and a mutable MultiKey for lookups, with matching equals and
hashCode implementations?

  void put(Obj a, Obj b, ...) {
    map.put(new MultiKey(a, b, ..));
  }

private MutableMultiKey lookupKey = new MutableMultiKey();

  Object get(Obj a, Obj b, ...) {
    lookupKey.setKeys(a, b, ..));
    return map.get(lookupKey);
  }

I have something that works this way lying around somewhere.

I'm not 100% sure, but I don't think this is thread safe, since multiple threads may be calling the get method at the same time and thus modifying the lookupKey instance var.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to