mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[r=Peter.Gromov] tolerate null key for get and containsKey
This commit is contained in:
@@ -185,7 +185,8 @@ abstract class RefHashMap<K, V> extends AbstractMap<K, V> implements Map<K, V> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(@NotNull Object key) {
|
||||
public boolean containsKey(Object key) {
|
||||
if (key == null) return false;
|
||||
// optimization:
|
||||
myHardKeyInstance.set((K)key);
|
||||
boolean result = myMap.containsKey(myHardKeyInstance);
|
||||
@@ -194,7 +195,8 @@ abstract class RefHashMap<K, V> extends AbstractMap<K, V> implements Map<K, V> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get(@NotNull Object key) {
|
||||
public V get(Object key) {
|
||||
if (key == null) return null;
|
||||
myHardKeyInstance.set((K)key);
|
||||
V result = myMap.get(myHardKeyInstance);
|
||||
myHardKeyInstance.clear();
|
||||
|
||||
Reference in New Issue
Block a user