public interface HashingStrategy<T>
Modifier and Type | Field and Description |
---|---|
static HashingStrategy |
JAVA_HASHER
一个 HashingStrategy ,它代表java的Object.hashCode() 和Object.equals(Object) 。
|
static final HashingStrategy JAVA_HASHER
HashingStrategy
代表java的Object.hashCode()
和Object.equals(Object)
。
int hashCode(T obj)
obj
的哈希码。
此方法必须遵守Object.hashCode()
与Object.equals(Object)
具有的相同关系:
obj
多次调用此方法应返回相同的结果 equals(Object, Object)
与参数a
和b
回报true
则此方法参数的返回值a
和b
必须返回相同的结果 equals(Object, Object)
与参数a
和b
回报false
则此方法参数的返回值a
和b
不必返回不同的结果的结果。 然而这个属性是可取的。 obj
是null
那么此方法返回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–2018 The Netty Project. All rights reserved.