public int hashValue ( Object object ) { int x ; // make sure the hash value is consistent across JVM invocations if ( object instanceof Boolean || object instanceof Character || object instanceof String || object instanceof Number || object instanceof Date ) { x = object . hashCode ( ) ; } else if ( object . getClass ( ) . isArray ( ) ) { Object [ ] array = ( Object [ ] ) object ; x = Arrays . toString ( array ) . hashCode ( ) ; // array.hashCode() returns the memory address of the array! } else { x = object . toString ( ) . hashCode ( ) ; // make sure it isn't calling Object.hashCode()! } int hash = ( a * x + b ) >>> d ; // unsigned shift right return hash ; }
This method generates a hash value for the specified object using the universal hash function parameters specified in the constructor . The result will be a hash value containing the hash width number of bits .