mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-23 06:42:05 +01:00
#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:
parent
0fdda5bc4d
commit
1a08715f67
1 changed files with 17 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue