mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8267110: Update java.util to use instanceof pattern variable
Reviewed-by: lancea, naoto
This commit is contained in:
parent
0a03fc84b3
commit
a52c4ede2f
29 changed files with 142 additions and 266 deletions
|
@ -476,9 +476,8 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
|||
if (o == this)
|
||||
return true;
|
||||
|
||||
if (!(o instanceof Map))
|
||||
if (!(o instanceof Map<?, ?> m))
|
||||
return false;
|
||||
Map<?,?> m = (Map<?,?>) o;
|
||||
if (m.size() != size())
|
||||
return false;
|
||||
|
||||
|
@ -688,10 +687,9 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
|||
* @see #hashCode
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof Map.Entry))
|
||||
return false;
|
||||
Map.Entry<?,?> e = (Map.Entry<?,?>)o;
|
||||
return eq(key, e.getKey()) && eq(value, e.getValue());
|
||||
return o instanceof Map.Entry<?, ?> e
|
||||
&& eq(key, e.getKey())
|
||||
&& eq(value, e.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -822,10 +820,9 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
|||
* @see #hashCode
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof Map.Entry))
|
||||
return false;
|
||||
Map.Entry<?,?> e = (Map.Entry<?,?>)o;
|
||||
return eq(key, e.getKey()) && eq(value, e.getValue());
|
||||
return o instanceof Map.Entry<?, ?> e
|
||||
&& eq(key, e.getKey())
|
||||
&& eq(value, e.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue