Created
November 30, 2010 01:22
-
-
Save bradleybeddoes/720964 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public boolean equals(Object obj) { | |
| if (obj == null) { return false; } | |
| if (obj == this) { return true; } | |
| if (obj.getClass() != getClass()) { | |
| return false; | |
| } | |
| Uri rhs = (Uri) obj; | |
| return new EqualsBuilder() | |
| .appendSuper(super.equals(obj)) | |
| .append(uri, rhs.uri) | |
| .append(description, rhs.description) | |
| .append(dateCreated, rhs.dateCreated) | |
| .isEquals(); | |
| } | |
| public int hashCode() { | |
| // hard-coded, randomly chosen, non-zero, odd number different for each class | |
| return new HashCodeBuilder(99, 297). | |
| append(uri). | |
| append(description). | |
| append(dateCreated). | |
| toHashCode(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment