Created
March 18, 2013 14:04
-
-
Save zacker330/5187363 to your computer and use it in GitHub Desktop.
equals and hashCode of java
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
@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