public final class HashCodeUtil extends Object
hashCode.
Example use case:
public int hashCode() {
int result = HashCodeUtil.SEED;
//collect the contributions of various fields
result = HashCodeUtil.hash(result, fPrimitive);
result = HashCodeUtil.hash(result, fObject);
result = HashCodeUtil.hash(result, fArray);
return result;
}
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
SEED
An initial value for a
hashCode, to which is added
contributions from fields. |
| 构造器和说明 |
|---|
HashCodeUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
hash(int aSeed,
boolean aBoolean)
booleans.
|
static int |
hash(int aSeed,
char aChar)
chars.
|
static int |
hash(int aSeed,
double aDouble)
doubles.
|
static int |
hash(int aSeed,
float aFloat)
floats.
|
static int |
hash(int aSeed,
int aInt)
ints.
|
static int |
hash(int aSeed,
long aLong)
longs.
|
static int |
hash(int aSeed,
Object aObject)
aObject is a possibly-null object field, and possibly an array. |
public static final int SEED
hashCode, to which is added
contributions from fields. Using a non-zero value decreases collisons of
hashCode values.public static int hash(int aSeed,
boolean aBoolean)
aSeed - the a seedaBoolean - the a booleanpublic static int hash(int aSeed,
char aChar)
aSeed - the a seedaChar - the a charpublic static int hash(int aSeed,
int aInt)
aSeed - the a seedaInt - the a intpublic static int hash(int aSeed,
long aLong)
aSeed - the a seedaLong - the a longpublic static int hash(int aSeed,
float aFloat)
aSeed - the a seedaFloat - the a floatpublic static int hash(int aSeed,
double aDouble)
aSeed - the a seedaDouble - the a doublepublic static int hash(int aSeed,
Object aObject)
aObject is a possibly-null object field, and possibly an array.
If aObject is an array, then each element may be a primitive or a possibly-null object.aSeed - the a seedaObject - the a objectCopyright © 2006–2016 MyBatis.org. All rights reserved.