src/share/classes/java/util/Hashtable.java
Print this page
rev 7682 : 8021591: Additional explicit null checks
Reviewed-by: duke
*** 1016,1025 ****
--- 1016,1027 ----
return false;
}
@Override
public synchronized boolean replace(K key, V oldValue, V newValue) {
+ Objects.requireNonNull(oldValue);
+ Objects.requireNonNull(newValue);
Entry<?,?> tab[] = table;
int hash = hash(key);
int index = (hash & 0x7FFFFFFF) % tab.length;
@SuppressWarnings("unchecked")
Entry<K,V> e = (Entry<K,V>)tab[index];
*** 1036,1045 ****
--- 1038,1048 ----
return false;
}
@Override
public synchronized V replace(K key, V value) {
+ Objects.requireNonNull(value);
Entry<?,?> tab[] = table;
int hash = hash(key);
int index = (hash & 0x7FFFFFFF) % tab.length;
@SuppressWarnings("unchecked")
Entry<K,V> e = (Entry<K,V>)tab[index];