8267110: Update java.util to use instanceof pattern variable

Reviewed-by: lancea, naoto
This commit is contained in:
Patrick Concannon 2021-05-25 08:24:49 +00:00
parent 0a03fc84b3
commit a52c4ede2f
29 changed files with 142 additions and 266 deletions

View file

@ -885,10 +885,9 @@ public final class Locale implements Cloneable, Serializable {
if (this == obj) {
return true;
}
if (!(obj instanceof LocaleKey)) {
if (!(obj instanceof LocaleKey other)) {
return false;
}
LocaleKey other = (LocaleKey)obj;
if (hash != other.hash || !base.equals(other.base)) {
return false;
}
@ -3341,12 +3340,9 @@ public final class Locale implements Cloneable, Serializable {
if (this == obj) {
return true;
}
if (!(obj instanceof LanguageRange)) {
return false;
}
LanguageRange other = (LanguageRange)obj;
return range.equals(other.range)
&& weight == other.weight;
return obj instanceof LanguageRange other
&& range.equals(other.range)
&& weight == other.weight;
}
/**