mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8221924: get(null) on single-entry unmodifiable Map returns null instead of throwing NPE
Reviewed-by: redestad, lancea
This commit is contained in:
parent
b0c2b42e40
commit
1aa784cdac
2 changed files with 12 additions and 2 deletions
|
@ -881,6 +881,11 @@ class ImmutableCollections {
|
|||
return Set.of(new KeyValueHolder<>(k0, v0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get(Object o) {
|
||||
return o.equals(k0) ? v0 : null; // implicit nullcheck of o
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object o) {
|
||||
return o.equals(k0); // implicit nullcheck of o
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue