[concurrency-interest] ConcurrentHashMapV8

√iktor Ҡlang viktor.klang at gmail.com
Mon Oct 3 12:04:06 EDT 2011

On Mon, Oct 3, 2011 at 5:47 PM, Kasper Nielsen <kasper at kav.dk> wrote:

> 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.

You're a firm disbeliever is the Single Responsibility Principle?

The computation of the hashCode of the Key is distinctly something else from
comparing equality of Values.

> 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.

What? As I said, how does the equivalence-checking of the Values interact
with the hash of the Keys?

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

That is about the equivalence of the Keys, not of the Values.

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

I'd be surprised if there aren't thousands of similar implementations all
over the Java ecosystem due to the lack of it in the standard library.


> cheers
>  Kasper
> ______________________________**_________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.**oswego.edu <Concurrency-interest at cs.oswego.edu>
> http://cs.oswego.edu/mailman/**listinfo/concurrency-interest<http://cs.oswego.edu/mailman/listinfo/concurrency-interest>

Viktor Klang

Akka Tech Lead
Typesafe <http://www.typesafe.com/> - Enterprise-Grade Scala from the

Twitter: @viktorklang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20111003/ddf57a84/attachment.html>

More information about the Concurrency-interest mailing list