Java Utililty Methods Hash Calculate

List of utility methods to do Hash Calculate

Description

The list of methods to do Hash Calculate are organized into topic(s).

Method

inthash(final Object[] objects)
Compute a hash code for a collection of objects from their individual hash codes.
if (objects.length == 0) {
    return 0;
final Object obj = objects[0];
int hash = (obj == null ? 0 : objects[0].hashCode()) + 43;
for (int i = 1; i < objects.length; i++) {
    final Object ob = objects[i];
    final int h = ob == null ? 0 : ob.hashCode();
...
inthash(finalObject object)
hash
return object == null ? 0 : object.hashCode();
inthash(int aSeed, boolean aBoolean)
booleans.
return firstTerm(aSeed) + (aBoolean ? 1 : 0);
inthash(int aSeed, Object[] aArray)
Arrays of Objects.
int result = aSeed;
for (int idx = 0; idx < aArray.length; ++idx) {
    result = hash(result, aArray[idx]);
return result;
inthash(int base, boolean field)
Retrieves a unique hash value for the specified field, based on the specified base value.
return PRIME * base + (field ? 0 : 1);
inthash(int h)
hash
h ^= (h >>> 20) ^ (h >>> 12);
return h ^ (h >>> 7) ^ (h >>> 4);
inthash(int h)
hash
h ^= (h >>> 20) ^ (h >>> 12);
return h ^ (h >>> 7) ^ (h >>> 4);
inthash(int h, boolean v)
hash
return h * 37 + (v ? 2 : 1);
inthash(int h, Object o)
Computes a hash code from an existing hash code and an object (which may be null).
int k = (o == null) ? 0 : o.hashCode();
return ((h << 4) | h) ^ k;
inthash(int hash, boolean item)
Add a boolean value to a given hash.
return hash * prime + (item ? 1 : 0);