groovyx.gpars.extra166y
Interface CustomConcurrentHashMap.Equivalence<K>

All Known Implementing Classes:
CustomConcurrentHashMap.EquivalenceUsingEquals, CustomConcurrentHashMap.EquivalenceUsingIdentity
Enclosing class:
CustomConcurrentHashMap<K,V>

public static interface CustomConcurrentHashMap.Equivalence<K>

An object performing equality comparisons, along with a hash function consistent with this comparison. The type signatures of the methods of this interface reflect those of Map: While only elements of K may be entered into a Map, any Object may be tested for membership. Note that the performance of hash maps is heavily dependent on the quality of hash functions.


Method Summary
 boolean equal(K key, java.lang.Object x)
          Returns true if the given objects are considered equal.
 int hash(java.lang.Object x)
          Returns a hash value such that equal(a, b) implies hash(a)==hash(b).
 

Method Detail

equal

boolean equal(K key,
              java.lang.Object x)
Returns true if the given objects are considered equal. This function must obey an equivalence relation: equal(a, a) is always true, equal(a, b) implies equal(b, a), and (equal(a, b) && equal(b, c) implies equal(a, c). Note that the second argument need not be known to have the same declared type as the first.

Parameters:
key - a key in, or being placed in, the map
x - an object queried for membership
Returns:
true if considered equal

hash

int hash(java.lang.Object x)
Returns a hash value such that equal(a, b) implies hash(a)==hash(b).

Parameters:
x - an object queried for membership
Returns:
a hash value

Copyright © 2008–2012 Václav Pech. All Rights Reserved.