public class HashCode
extends java.lang.Object
hashCode().
Based on items #7 and #8 from "Effective Java" book.
Usage scenario:
return HashCode.create()
.hash(value1)
.hash(value2)
...
.get();
| Constructor and Description |
|---|
HashCode(int seed,
int prime) |
| Modifier and Type | Method and Description |
|---|---|
static HashCode |
create()
Creates new HashCode calculator.
|
static HashCode |
create(int seed,
int prime)
Creates new HashCode calculator with custom seed and prime number.
|
int |
get()
Returns the calculated hashcode value.
|
HashCode |
hash(boolean aBoolean)
Calculates hash code for booleans.
|
HashCode |
hash(boolean[] booleanArray)
Calculates hash code for boolean array.
|
HashCode |
hash(byte[] byteArray)
Calculates hash code for byte array.
|
HashCode |
hash(char aChar)
Calculates hash code for chars.
|
HashCode |
hash(char[] charArray)
Calculates hash code for char array.
|
HashCode |
hash(double aDouble)
Calculates hash code for doubles.
|
HashCode |
hash(double[] doubleArray)
Calculates hash code for double array.
|
HashCode |
hash(float aFloat)
Calculates hash code for floats.
|
HashCode |
hash(float[] floatArray)
Calculates hash code for float array.
|
HashCode |
hash(int anInt)
Calculates hash code for ints.
|
HashCode |
hash(int[] intArray)
Calculates hash code for int array.
|
HashCode |
hash(long aLong)
Calculates hash code for longs.
|
HashCode |
hash(long[] longArray)
Calculates hash code for long array.
|
HashCode |
hash(java.lang.Object aObject)
Calculates hash code for Objects.
|
HashCode |
hash(short[] shortArray)
Calculates hash code for short array.
|
static int |
smear(int hashCode)
Smears hash code.
|
public static int smear(int hashCode)
public static HashCode create()
public static HashCode create(int seed, int prime)
public int get()
public HashCode hash(boolean aBoolean)
public HashCode hash(boolean[] booleanArray)
public HashCode hash(char aChar)
public HashCode hash(char[] charArray)
public HashCode hash(int anInt)
public HashCode hash(int[] intArray)
public HashCode hash(short[] shortArray)
public HashCode hash(byte[] byteArray)
public HashCode hash(long aLong)
public HashCode hash(long[] longArray)
public HashCode hash(float aFloat)
public HashCode hash(float[] floatArray)
public HashCode hash(double aDouble)
public HashCode hash(double[] doubleArray)
public HashCode hash(java.lang.Object aObject)
If aObject is an array, then each element may be a primitive
or a possibly-null object.
Copyright © 2003-present Jodd Team