[concurrency-interest] ConcurrentHashMapV8

Kasper Nielsen kasper at kav.dk
Mon Oct 3 11:47:12 EDT 2011


On 03-10-2011 17:18, √iktor Ҡlang wrote:
> The tie is the parameterized type signature of ? extends Hashable<K> &
> Equivalence<V>,
> smashing them together would really limit the usefulness and doesn't add
> any value.

I really do not see practically reason for separating these into 2 
different interfaces. Only more clutter.

First of all, 90 % of all usage will be either Equivalence.Equals or 
Equivalence.Identity. With probably Equivalence.ignoreStringCase as a 
trailing third. These can all be predefined so users do not need to 
implement anything.

Second, I think almost all usage will be in situations where you
will also need the custom hash, for example, for keys in a hash map.

See also
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/extra166y/CustomConcurrentHashMap.java 
which supports user-defined equivalence comparisons.

Guava has an identical interface com.google.common.base.Equivalence.

cheers
   Kasper


More information about the Concurrency-interest mailing list