public class HashCode
extends java.lang.Object
hashCode()
.
Based on items #7 and #8 from "Effective Java" book.
Usage scenario:
int result = HashCodeUtil.SEED; result = HashCodeUtil.hash(result, value1); result = HashCodeUtil.hash(result, value2); ... return result;
Modifier and Type | Field and Description |
---|---|
static int |
PRIME |
static int |
SEED
An initial hash code value to which is added contributions from fields.
|
Constructor and Description |
---|
HashCode() |
Modifier and Type | Method and Description |
---|---|
static int |
hash(int seed,
boolean aBoolean)
Calculates hash code for booleans.
|
static int |
hash(int seed,
boolean[] booleanArray)
Calculates hash code for boolean array.
|
static int |
hash(int seed,
byte[] byteArray)
Calculates hash code for byte array.
|
static int |
hash(int seed,
char aChar)
Calculates hash code for chars.
|
static int |
hash(int seed,
char[] charArray)
Calculates hash code for char array.
|
static int |
hash(int seed,
double aDouble)
Calculates hash code for doubles.
|
static int |
hash(int seed,
double[] doubleArray)
Calculates hash code for double array.
|
static int |
hash(int seed,
float aFloat)
Calculates hash code for floats.
|
static int |
hash(int seed,
float[] floatArray)
Calculates hash code for float array.
|
static int |
hash(int seed,
int anInt)
Calculates hash code for ints.
|
static int |
hash(int seed,
int[] intArray)
Calculates hash code for int array.
|
static int |
hash(int seed,
long aLong)
Calculates hash code for longs.
|
static int |
hash(int seed,
long[] longArray)
Calculates hash code for long array.
|
static int |
hash(int seed,
java.lang.Object aObject)
Calculates hash code for Objects.
|
static int |
hash(int seed,
short[] shortArray)
Calculates hash code for short array.
|
static int |
hashBooleanArray(int seed,
boolean... booleanArray)
Calculates hash code for boolean array.
|
static int |
hashByteArray(int seed,
byte... byteArray)
Calculates hash code for byte array.
|
static int |
hashCharArray(int seed,
char... charArray)
Calculates hash code for char array.
|
static int |
hashDoubleArray(int seed,
double... doubleArray)
Calculates hash code for double array.
|
static int |
hashFloatArray(int seed,
float... floatArray)
Calculates hash code for float array.
|
static int |
hashIntArray(int seed,
int... intArray)
Calculates hash code for int array.
|
static int |
hashLongArray(int seed,
long... longArray)
Calculates hash code for long array.
|
static int |
hashShortArray(int seed,
short... shortArray)
Calculates hash code for short array.
|
static int |
smear(int hashCode)
Smear hash code.
|
public static final int SEED
public static final int PRIME
public static int smear(int hashCode)
public static int hash(int seed, boolean aBoolean)
public static int hash(int seed, boolean[] booleanArray)
public static int hashBooleanArray(int seed, boolean... booleanArray)
public static int hash(int seed, char aChar)
public static int hash(int seed, char[] charArray)
public static int hashCharArray(int seed, char... charArray)
public static int hash(int seed, int anInt)
public static int hash(int seed, int[] intArray)
public static int hashIntArray(int seed, int... intArray)
public static int hash(int seed, short[] shortArray)
public static int hashShortArray(int seed, short... shortArray)
public static int hash(int seed, byte[] byteArray)
public static int hashByteArray(int seed, byte... byteArray)
public static int hash(int seed, long aLong)
public static int hash(int seed, long[] longArray)
public static int hashLongArray(int seed, long... longArray)
public static int hash(int seed, float aFloat)
public static int hash(int seed, float[] floatArray)
public static int hashFloatArray(int seed, float... floatArray)
public static int hash(int seed, double aDouble)
public static int hash(int seed, double[] doubleArray)
public static int hashDoubleArray(int seed, double... doubleArray)
public static int hash(int seed, java.lang.Object aObject)
If aObject
is an array, then each element may be a primitive
or a possibly-null object.
Copyright © 2003-2013 Jodd Team