Skip to content

Commit 6d1d97e

Browse files
committed
Fixed #204
1 parent 3b27362 commit 6d1d97e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

dbus-java-core/src/main/java/org/freedesktop/dbus/MethodTuple.java

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.freedesktop.dbus;
22

3+
import java.util.Objects;
4+
35
import org.slf4j.Logger;
46
import org.slf4j.LoggerFactory;
57

@@ -20,13 +22,20 @@ public MethodTuple(String _name, String _sig) {
2022
}
2123

2224
@Override
23-
public boolean equals(Object _o) {
24-
return _o.getClass().equals(MethodTuple.class) && ((MethodTuple) _o).name.equals(this.name) && ((MethodTuple) _o).sig.equals(this.sig);
25+
public int hashCode() {
26+
return Objects.hash(name, sig);
2527
}
2628

2729
@Override
28-
public int hashCode() {
29-
return name.hashCode() + sig.hashCode();
30+
public boolean equals(Object _obj) {
31+
if (this == _obj) {
32+
return true;
33+
}
34+
if (!(_obj instanceof MethodTuple)) {
35+
return false;
36+
}
37+
MethodTuple other = (MethodTuple) _obj;
38+
return Objects.equals(name, other.name) && Objects.equals(sig, other.sig);
3039
}
3140

3241
public Logger getLogger() {

0 commit comments

Comments
 (0)