List of utility methods to do Hash Calculate
int | hash(Object obj) Same hash function as HashMap#newHash method.
int h = obj.hashCode(); h ^= (h >>> 20) ^ (h >>> 12); return h ^ (h >>> 7) ^ (h >>> 4); |
Integer | hash(Object obj) hash Integer rtn = null; if (obj != null) { rtn = obj.hashCode(); return rtn; |
int | hash(Object object) Returns a hash code for non-null Object x. int h = object.hashCode(); h ^= (h >>> DOUG_LEA_BLACK_MAGIC_OPERAND_1) ^ (h >>> DOUG_LEA_BLACK_MAGIC_OPERAND_2); return h ^ (h >>> DOUG_LEA_BLACK_MAGIC_OPERAND_3) ^ (h >>> DOUG_LEA_BLACK_MAGIC_OPERAND_4); |
int | hash(Object v) hash return v == null ? 0 : v.hashCode();
|
String | hash(Object value) hash if (value == null) { return "null"; int hashcode = value.hashCode(); char[] hexChars = new char[8]; hexChars[0] = HEX_CHARS[(hashcode >> 28) & 0xF]; hexChars[1] = HEX_CHARS[(hashcode >> 24) & 0xF]; hexChars[2] = HEX_CHARS[(hashcode >> 20) & 0xF]; ... |
int | hash(Object value, int seed) Alters the given seed with the hash code value computed from the given value. seed *= PRIME_NUMBER; if (value != null) { assert !value.getClass().isArray() : value; seed += value.hashCode(); return seed; |
int | hash(Object... as) Create a hash code for a list of objects. if (as == null) return 0; int hash = 0; for (Object a : as) { if (hash != 0) hash = 41 * hash + hash1(a); else hash = 41 + hash1(a); ... |
long | hash(Object... value) hash String key = toString(value); long hash; int i; for (hash = key.length(), i = 0; i < key.length(); ++i) hash = (hash << 4) ^ (hash >> 28) ^ key.charAt(i); return hash; |
int | hash(Object... values) hash int code = 17; for (Object value : values) { code += hashOrNull(value); code *= 37; return code; |
int | hash(Object[] array) calculate the array hash (only the first level) int length = array.length; int seed = SEED; for (Object anArray : array) { seed = hash(seed, anArray == null ? 0 : anArray.hashCode()); return seed; |