public interface HashingStrategy<T>
| 限定符和类型 | 字段和说明 |
|---|---|
static HashingStrategy |
JAVA_HASHER
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(T a,
T b)
Returns
true if the arguments are equal to each other and false otherwise. |
int |
hashCode(T obj)
Generate a hash code for
obj. |
static final HashingStrategy JAVA_HASHER
int hashCode(T obj)
obj.
This method must obey the same relationship that Object.hashCode() has with
Object.equals(Object):
obj should return the same resultequals(Object, Object) with parameters a and b returns true
then the return value for this method for parameters a and b must return the same resultequals(Object, Object) with parameters a and b returns false
then the return value for this method for parameters a and b does not have to
return different results results. However this property is desirable.obj is null then this method return 0boolean equals(T a, T b)
true if the arguments are equal to each other and false otherwise.
This method has the following restrictions:
equals(a, a) should return trueequals(a, b) returns true if equals(b, a) returns
trueequals(a, b) returns true and equals(a, c) returns
true then equals(b, c) should also return trueequals(a, b) should return the same result when called multiple times
assuming a and b remain unchanged relative to the comparison criteriaa and b are both null then this method returns truea is null and b is non-null, or a is non-null and
b is null then this method returns false