Browse Source

Add equals and hashcode to ChannelJoinRequest

Change-Id: Ie03fcd02a391f5c2003a891de586cb6144acadc4
Reviewed-on: http://gerrit.dmdirc.com/1042
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
tags/0.6.4
Chris Smith 14 years ago
parent
commit
60691fa096
1 changed files with 17 additions and 0 deletions
  1. 17
    0
      src/com/dmdirc/parser/common/ChannelJoinRequest.java

+ 17
- 0
src/com/dmdirc/parser/common/ChannelJoinRequest.java View File

@@ -75,4 +75,21 @@ public class ChannelJoinRequest {
75 75
         return password;
76 76
     }
77 77
 
78
+    /** {@inheritDoc} */
79
+    @Override
80
+    public boolean equals(final Object obj) {
81
+        return obj instanceof ChannelJoinRequest
82
+                && ((ChannelJoinRequest) obj).getName().equals(name)
83
+                && ((((ChannelJoinRequest) obj).getPassword() == null
84
+                ? password == null : ((ChannelJoinRequest) obj).getPassword().equals(password)));
85
+    }
86
+
87
+    /** {@inheritDoc} */
88
+    @Override
89
+    public int hashCode() {
90
+        int hash = name != null ? name.hashCode() : 0;
91
+        hash = 13 * hash + (password != null ? password.hashCode() : 0);
92
+        return hash;
93
+    }
94
+
78 95
 }

Loading…
Cancel
Save