I have an address object that I want to create an equals method for. I could have made this quite simple by doing something like the following (shortened a bit):
Apache Commons Lang provides the EqualsBuilder helper class for equality comparissons. There is also one for hash codes.
return new EqualsBuilder()
.append(this.getStreet(), other.getStreet())
.append(this.getStreetNumber(), other.getStreetNumber()
.append(this.getStreetLetter(), other.getStreetLetter())
.append(this.getTown(), other.getTown())).isEquals();