This simplifies the equality contract a bit.
Change-Id: Ie59c58e70e8c7de2b1898f58c99c84694073f86a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
@Override
public final boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof ValueRange)) {
- return false;
- }
- final ValueRange other = (ValueRange) obj;
- return lowerBound().equals(other.lowerBound()) && upperBound().equals(other.upperBound());
+ return this == obj || obj instanceof ValueRange other
+ && lowerBound().equals(other.lowerBound()) && upperBound().equals(other.upperBound());
}
}