Skip to content

Instantly share code, notes, and snippets.

@kungfoo
Created November 17, 2010 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kungfoo/703511 to your computer and use it in GitHub Desktop.
Save kungfoo/703511 to your computer and use it in GitHub Desktop.
Objects.equal() and hashCode()
@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