[wpilibj] Watchdog: Implement equals and hashCode (#2743)

This commit is contained in:
Peter Johnson
2020-09-27 13:25:56 -07:00
committed by GitHub
parent 9725aff83b
commit c55fb583b8

View File

@@ -72,6 +72,20 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
return Double.compare(m_expirationTime, rhs.m_expirationTime);
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Watchdog)) {
return false;
}
Watchdog oth = (Watchdog) obj;
return oth.m_expirationTime == m_expirationTime;
}
@Override
public int hashCode() {
return Double.hashCode(m_expirationTime);
}
/**
* Returns the time in seconds since the watchdog was last fed.
*/