views:

65

answers:

1

Dear all,

I need a Concurrent Hash Map with Weak or Soft keys were the equality is equals and not ==.

For this kind of keys, google collection chooses == by default.

Is there a way to override this choice? How should I proceed?

Best regards,

Nicolas.

A: 

You can't do that in google-collections. You can't do it in guava either, currently. However, they have added an Equivalence interface and the implementations you'd expect for it (equals, null-aware equals and ==) recently and it seems like they might allow you to specify what Equivalence should be used for keys/values in the future (see this issue). MapMaker code seems to be undergoing some changes at this time.

ColinD