Skip to content

Instantly share code, notes, and snippets.

@zacker330
Created March 18, 2013 14:04
Show Gist options
  • Save zacker330/5187363 to your computer and use it in GitHub Desktop.
Save zacker330/5187363 to your computer and use it in GitHub Desktop.
equals and hashCode of java
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof TaskAssignment)) {
return false;
}
TaskAssignment that = (TaskAssignment) other;
return new EqualsBuilder().append(this.getAcount(), that.getAcount()).append(this.getTask(), that.getTask()).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(37, 17).append(getId()).append(getTask()).toHashCode();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment