You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was shown in a recent Java Collections Puzzlers. The JavaDoc for Map.putIfAbsent states the following.
If the specified key is not already associated with a value (or is mapped to {@code null}) associates it with the given value and returns {@code null}, else returns the current value.
FAILED: Test.putIfAbsent_nullExistingValue
key is present but with a different value
value of: map.get(a)
expected: b
but was : null
map was : {a=>null}
The computeIfAbsent method has similar wording and fails in this scenario.
I have requested that this peculiarity of the api be added to Guava's testlib.
The text was updated successfully, but these errors were encountered:
This was shown in a recent Java Collections Puzzlers. The JavaDoc for
Map.putIfAbsent
states the following.The
computeIfAbsent
method has similar wording and fails in this scenario.I have requested that this peculiarity of the api be added to Guava's testlib.
The text was updated successfully, but these errors were encountered: