Java Hash Calculate hash(Object[] array)

Here you can find the source of hash(Object[] array)

Description

hash

License

Open Source License

Declaration

private static int hash(Object[] array) 

Method Source Code

//package com.java2s;

public class Main {
    private static final int MULTIPLIER = 37;

    private static int hash(Object o1) {
        return (o1 == null) ? 0 : o1.hashCode();
    }//from  w  ww.  j ava  2  s. c  o m

    private static int hash(boolean b) {
        return b ? 1 : 104729;
    }

    private static int hash(Object[] array) {
        int hash = 0;
        for (int i = 0; i < array.length; ++i) {
            Object o = array[i];
            hash = combine(hash, hash(o));
        }
        return hash;
    }

    private static int combine(int hash1, int hash2) {
        return MULTIPLIER * hash1 + hash2;
    }
}

Related

  1. hash(Object value, int seed)
  2. hash(Object... as)
  3. hash(Object... value)
  4. hash(Object... values)
  5. hash(Object[] array)
  6. hash(Object[] state)
  7. hash1(int val)
  8. hash1(Object a)
  9. hash16(int hash)