Method
replace
(int key, @Nullable V value)
Source from the content-addressed store, hash-verified
| 286 | } |
| 287 | |
| 288 | public @Nullable V replace(int key, @Nullable V value) { |
| 289 | if (key == 0) { |
| 290 | final V oldV = zeroValue; |
| 291 | if (hasZeroValue) |
| 292 | zeroValue = value; |
| 293 | return oldV; |
| 294 | } |
| 295 | final int[] kt = keyTable; |
| 296 | final V[] vt = valueTable; |
| 297 | final int m = mask; |
| 298 | for (int i = hash(key); ; i = (i + 1) & m) { |
| 299 | final int k = kt[i]; |
| 300 | if (k == 0) |
| 301 | return null; |
| 302 | if (k == key) { |
| 303 | final V oldV = vt[i]; |
| 304 | vt[i] = value; |
| 305 | return oldV; |
| 306 | } |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | public boolean replace(int key, @Nullable V oldValue, @Nullable V newValue) { |
| 311 | if (key == 0) { |
Callers
nothing calls this directly
Tested by
no test coverage detected