public static int hashObject(Object o){
  return o == null ? 0 : o.hashCode();
}

public static int hashObject ( Object o ) { return o == null ? 0 : o . hashCode ( ) ; }
null - safe hash code method for objects . returns the object hash code if it is not null , and 0 otherwise .
