public final class HashUtil
extends java.lang.Object
hashCode method.
Only native types and Object types are supported so far.
Usage:
public int hashCode()
{
int result = HashUtil.HASH_SEED;
// collect the contributions of various fields
result = HashUtil.hash(result, nativeType);
result = HashUtil.hash(result, objectType);
return result;
}
| Modifier and Type | Field and Description |
|---|---|
static int |
HASH_SEED
Hash seed number to be used for initialization.
|
| Constructor and Description |
|---|
HashUtil() |
| Modifier and Type | Method and Description |
|---|---|
static int |
hash(int seedValue,
boolean booleanValue)
Creates a hash value of the given seed value and the given boolean value.
|
static int |
hash(int seedValue,
char charValue)
Creates a hash value of the given seed value and the given char value.
|
static int |
hash(int seedValue,
double doubleValue)
Creates a hash value of the given seed value and the given double value.
|
static int |
hash(int seedValue,
float floatValue)
Creates a hash value of the given seed value and the given float value.
|
static int |
hash(int seedValue,
int intValue)
Creates a hash value of the given seed value and the given integer value.
|
static int |
hash(int seedValue,
long longValue)
Creates a hash value of the given seed value and the given long value.
|
static int |
hash(int seedValue,
java.lang.Object objectType)
Creates a hash value of the given seed value and the given object.
|
public static final int HASH_SEED
public static int hash(int seedValue,
boolean booleanValue)
seedValue - The seed value to use for calculation.booleanValue - The boolean value to use for calculation.public static int hash(int seedValue,
char charValue)
seedValue - The seed value to use for calculation.charValue - The char value to use for calculation.public static int hash(int seedValue,
int intValue)
seedValue - The seed value to use for calculation.intValue - The integer value to use for calculation.public static int hash(int seedValue,
long longValue)
seedValue - The seed value to use for calculation.longValue - The long value to use for calculation.public static int hash(int seedValue,
float floatValue)
seedValue - The seed value to use for calculation.floatValue - The float value to use for calculation.public static int hash(int seedValue,
double doubleValue)
seedValue - The seed value to use for calculation.doubleValue - The double value to use for calculation.public static int hash(int seedValue,
java.lang.Object objectType)
seedValue - The seed value to use for calculation.objectType - The object to use for calculation.Last updated 2024-10-29 12:52:38