Compact hashcode method
class Foo { private String string; private Date date; private i; [...] public int hashCode() { int result; result = (string != null ? string.hashCode() : 0); result = 29 * result + (date != null ? date.hashCode() : 0); result = 31 * result + (i != null ? i : 0); [...] return result; }
Consider using larger prime numbers if the number of properties is large.