Created
December 8, 2012 10:32
-
-
Save rvazquezglez/4239730 to your computer and use it in GitHub Desktop.
metodos para equals y hashCode usando apache-commons-lang
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 int hashCode(){ | |
return new HashCodeBuilder() | |
.append(name) | |
.append(length) | |
.append(children) | |
.toHashCode(); | |
} | |
@Override | |
public boolean equals(final Object obj){ | |
if(obj instanceof Bean){ | |
final Bean other = (Bean) obj; | |
return new EqualsBuilder() | |
.append(name, other.name) | |
.append(length, other.length) | |
.append(children, other.children) | |
.isEquals(); | |
} else{ | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment