[concurrency-interest] ConcurrentHashMapV8

Mark Thornton mthornton at optrak.com
Mon Oct 3 11:06:05 EDT 2011


On 03/10/11 15:59, √iktor Ҡlang wrote:
>
>
>     A Comparator wouldn't be appropriate for a HashMap.
>
>>
>
> Appropriate? You mean just like doing a DNS lookup in the equals of 
> java.net.URL?

A Comparator requires a domain with an ordering whereas HashMap's can be 
used on unordered domains.
>
>     What you need is something like:
>
>     interface Equivalence<T> {
>        int hash(T value);
>        boolean isEqual(T a, T b);
>     }
>
>
> What does hashes have to do with equivalence? Is that appropriate?
>
> interface Hashable<T> {
>   int computeHashFor(T value);
> }
>
> interface Equivalence<T> {
>   boolean isEqual(T a, T b);
> }
>
> and then require something that implements both Hashable<K> and 
> Equivalence<V>
>

I think Hashable might extend Equivalence as this sort of hash is tied 
up with equivalence.

Mark

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


More information about the Concurrency-interest mailing list