Created
November 17, 2010 15:29
-
-
Save kungfoo/703511 to your computer and use it in GitHub Desktop.
Objects.equal() and hashCode()
This file contains 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 int hashCode() { | |
return Objects.hashCode(describe(), markerType()); | |
} | |
@Override | |
public boolean equals(Object obj) { | |
if (obj == this) { | |
return true; | |
} | |
if (obj instanceof ModelDifference) { | |
ModelDifference that = (ModelDifference) obj; | |
return Objects.equal(this.describe(), that.describe()) | |
&& Objects.equal(this.markerType(), that.markerType()); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment