|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjodd.util.HashCode
public class HashCode
Collected methods which allow easy implementation of hashCode().
Based on items #7 and #8 from "Effective Java" book.
Usage scenario:
int result = HashCodeUtil.SEED; result = HashCodeUtil.hash(result, fIsDecrepit); ... return result;
| Field Summary | |
|---|---|
static int |
PRIME
|
static int |
SEED
An initial hash code value to which is added contributions from fields. |
| Constructor Summary | |
|---|---|
HashCode()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SEED
public static final int PRIME
| Constructor Detail |
|---|
public HashCode()
| Method Detail |
|---|
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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||