GUACAMOLE-422: Implement equals() and hashCode() for GuacamoleProtocolVersion.

This commit is contained in:
Michael Jumper
2019-06-08 12:55:17 -07:00
parent dc66f84d71
commit df9a0b1662

View File

@@ -179,5 +179,28 @@ public class GuacamoleProtocolVersion {
);
}
@Override
public int hashCode() {
int hash = 7;
hash = 61 * hash + this.major;
hash = 61 * hash + this.minor;
hash = 61 * hash + this.patch;
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof GuacamoleProtocolVersion))
return false;
// Versions are equal if all major/minor/patch components are identical
final GuacamoleProtocolVersion otherVersion = (GuacamoleProtocolVersion) obj;
return this.major == otherVersion.getMajor()
&& this.minor == otherVersion.getMinor()
&& this.patch == otherVersion.getPatch();
}
}