#hashcode and #equals. SMACK-54

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@4348 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Alex Wenckus 2006-07-11 01:45:45 +00:00 committed by alex
parent 0fdda5bc4d
commit 1a08715f67
1 changed files with 17 additions and 0 deletions

View File

@ -101,4 +101,21 @@ public class Occupant {
public String getNick() {
return nick;
}
public boolean equals(Object obj) {
if(!(obj instanceof Occupant)) {
return false;
}
Occupant occupant = (Occupant)obj;
return jid.equals(occupant.jid);
}
public int hashCode() {
int result;
result = affiliation.hashCode();
result = 17 * result + role.hashCode();
result = 17 * result + jid.hashCode();
result = 17 * result + (nick != null ? nick.hashCode() : 0);
return result;
}
}