/** * hashCode that combines three strings using xor. * @return a hash code value on the entire object. */ public int hashCode() { // this will not work well if some of the strings are equal. int result = string1.hashCode(); result ^= string2.hashCode(); result ^= string3.hashCode(); // etc for all fields in the object return result; }