- java.lang.Object
-
- util.misc.HashCodeUtilities
-
public final class HashCodeUtilities extends java.lang.Object
Collected methods which allow easy implementation ofhashCode
. Example use case:public int hashCode() { int result = HashCodeUtil.hash(someField); result = HashCodeUtil.hash(result, fPrimitive); result = HashCodeUtil.hash(result, fObject); result = HashCodeUtil.hash(result, fArray); return result; }
-
-
Constructor Summary
Constructors Constructor Description HashCodeUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
hash(boolean value)
static int
hash(char value)
static int
hash(double value)
static int
hash(float value)
static int
hash(int value)
static int
hash(int aSeed, boolean aBoolean)
static int
hash(int aSeed, char aChar)
static int
hash(int aSeed, double aDouble)
static int
hash(int aSeed, float aFloat)
static int
hash(int aSeed, int aInt)
static int
hash(int aSeed, long aLong)
static int
hash(int seed, java.lang.Object object)
aObject
is a possibly-null object field, and possibly an array.static int
hash(long value)
static int
hash(java.lang.Object value)
-
-
-
Method Detail
-
hash
public static int hash(int aSeed, boolean aBoolean)
-
hash
public static int hash(boolean value)
-
hash
public static int hash(int aSeed, char aChar)
-
hash
public static int hash(char value)
-
hash
public static int hash(int aSeed, int aInt)
-
hash
public static int hash(int value)
-
hash
public static int hash(int aSeed, long aLong)
-
hash
public static int hash(long value)
-
hash
public static int hash(int aSeed, float aFloat)
-
hash
public static int hash(float value)
-
hash
public static int hash(int aSeed, double aDouble)
-
hash
public static int hash(double value)
-
hash
public static int hash(int seed, java.lang.Object object)
aObject
is a possibly-null object field, and possibly an array. IfaObject
is an array, then each element may be a primitive or a possibly-null object.- Parameters:
seed
- The seedobject
- The object- Returns:
- The hash.
-
hash
public static int hash(java.lang.Object value)
-
-