mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +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
|
@ -714,9 +714,8 @@ public class Hashtable<K,V>
|
|||
}
|
||||
|
||||
public boolean contains(Object o) {
|
||||
if (!(o instanceof Map.Entry))
|
||||
if (!(o instanceof Map.Entry<?, ?> entry))
|
||||
return false;
|
||||
Map.Entry<?,?> entry = (Map.Entry<?,?>)o;
|
||||
Object key = entry.getKey();
|
||||
Entry<?,?>[] tab = table;
|
||||
int hash = key.hashCode();
|
||||
|
@ -729,9 +728,8 @@ public class Hashtable<K,V>
|
|||
}
|
||||
|
||||
public boolean remove(Object o) {
|
||||
if (!(o instanceof Map.Entry))
|
||||
if (!(o instanceof Map.Entry<?, ?> entry))
|
||||
return false;
|
||||
Map.Entry<?,?> entry = (Map.Entry<?,?>) o;
|
||||
Object key = entry.getKey();
|
||||
Entry<?,?>[] tab = table;
|
||||
int hash = key.hashCode();
|
||||
|
@ -816,9 +814,8 @@ public class Hashtable<K,V>
|
|||
if (o == this)
|
||||
return true;
|
||||
|
||||
if (!(o instanceof Map))
|
||||
if (!(o instanceof Map<?, ?> t))
|
||||
return false;
|
||||
Map<?,?> t = (Map<?,?>) o;
|
||||
if (t.size() != size())
|
||||
return false;
|
||||
|
||||
|
@ -1393,9 +1390,8 @@ public class Hashtable<K,V>
|
|||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof Map.Entry))
|
||||
if (!(o instanceof Map.Entry<?, ?> e))
|
||||
return false;
|
||||
Map.Entry<?,?> e = (Map.Entry<?,?>)o;
|
||||
|
||||
return (key==null ? e.getKey()==null : key.equals(e.getKey())) &&
|
||||
(value==null ? e.getValue()==null : value.equals(e.getValue()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue