public interface HashingStrategy<T>
Modifier and Type | Field and Description |
---|---|
static HashingStrategy |
JAVA_HASHER
|
Modifier and Type | Method and Description |
---|---|
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 0
boolean 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
iff equals(b, a)
returns
true
equals(a, b)
returns true
and equals(a, c)
returns
true
then equals(b, c)
should also return true
equals(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 true
a
is null
and b
is non-null
, or a
is non-null
and
b
is null
then this method returns false
Copyright © 2008–2017 The Netty Project. All rights reserved.