Java Utililty Methods Hash Code Calculate

List of utility methods to do Hash Code Calculate

Description

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

Method

inthashCode(final int i)
Computes the hash code for an integer.
return i;
inthashCode(final int seed, final int hashcode)
hash Code
return seed * HASH_OFFSET + hashcode;
inthashCode(final int x, final int y)
Returns an integer hash code for a point.
final int hashX = ((Integer) x).hashCode();
final int hashY = ((Integer) y).hashCode();
return 31 * hashX + hashY;
inthashcode(final int[] array)
Computes a hashcode for an integer array, partially unrolled.
final int len = array.length;
int result = 23;
int i = 0;
for (; (i + 3) < len; i += 4) {
    result = (1874161 * result) + 
            (50653 * array[i]) + 
            (1369 * array[i + 1]) + 
            (37 * array[i + 2]) + array[i + 3];
...
inthashCode(final long l)
hash Code
return (int) (l ^ (l >>> 32));
inthashCode(final long l)
hash Code
return (int) (l ^ (l >>> 32));
inthashCode(final long v)
Return a hashcode for a long.
return (int) (v ^ (v >>> 32));
inthashCode(final Object obj)
Calculate hashcode of objects.
if (obj == null) {
    return 0;
if (obj.getClass().isArray()) {
    Object[] array = (Object[]) obj;
    int result = 17;
    for (int i = 0; i < array.length; i++) {
        result = result * 37 + hashCode(array[i]);
...
inthashCode(final Object obj)
hash Code
return (obj == null ? 0 : obj.hashCode());
inthashCode(final Object object)
Returns a hash code for an object, or zero if the object is null.
int result = 0;
if (object != null) {
    result = object.hashCode();
return result;