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
|
@ -681,16 +681,14 @@ public class LinkedHashMap<K,V>
|
|||
return new LinkedEntryIterator();
|
||||
}
|
||||
public final boolean contains(Object o) {
|
||||
if (!(o instanceof Map.Entry))
|
||||
if (!(o instanceof Map.Entry<?, ?> e))
|
||||
return false;
|
||||
Map.Entry<?,?> e = (Map.Entry<?,?>) o;
|
||||
Object key = e.getKey();
|
||||
Node<K,V> candidate = getNode(key);
|
||||
return candidate != null && candidate.equals(e);
|
||||
}
|
||||
public final boolean remove(Object o) {
|
||||
if (o instanceof Map.Entry) {
|
||||
Map.Entry<?,?> e = (Map.Entry<?,?>) o;
|
||||
if (o instanceof Map.Entry<?, ?> e) {
|
||||
Object key = e.getKey();
|
||||
Object value = e.getValue();
|
||||
return removeNode(hash(key), key, value, true, true) != null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue