8265746: Update java.time to use instanceof pattern variable (part II)

Reviewed-by: dfuchs, lancea, rriggs, chegar, naoto
This commit is contained in:
Patrick Concannon 2021-04-26 08:32:20 +00:00
parent a85f6cbbaa
commit 45c5da0fd3
20 changed files with 104 additions and 152 deletions

View file

@ -618,11 +618,9 @@ public abstract class Clock {
}
@Override
public boolean equals(Object obj) {
if (obj instanceof FixedClock) {
FixedClock other = (FixedClock) obj;
return instant.equals(other.instant) && zone.equals(other.zone);
}
return false;
return obj instanceof FixedClock other
&& instant.equals(other.instant)
&& zone.equals(other.zone);
}
@Override
public int hashCode() {
@ -670,11 +668,9 @@ public abstract class Clock {
}
@Override
public boolean equals(Object obj) {
if (obj instanceof OffsetClock) {
OffsetClock other = (OffsetClock) obj;
return baseClock.equals(other.baseClock) && offset.equals(other.offset);
}
return false;
return obj instanceof OffsetClock other
&& baseClock.equals(other.baseClock)
&& offset.equals(other.offset);
}
@Override
public int hashCode() {