Follow contract of computeIfAbsent LinkedCaseInsensitiveMap
This commit makes sure that LinkedCaseInsensitiveMap::computeIfAbsent honors the contract of the method, and also replaces the old entry if that mapped to null. Closes gh-26868
This commit is contained in:
@@ -102,6 +102,8 @@ class LinkedCaseInsensitiveMapTests {
|
||||
|
||||
assertThat(map.put("null", null)).isNull();
|
||||
assertThat(map.putIfAbsent("NULL", "value")).isNull();
|
||||
assertThat(map.put("null", null)).isEqualTo("value");
|
||||
assertThat(map.computeIfAbsent("NULL", s -> "value")).isEqualTo("value");
|
||||
assertThat(map.get("null")).isEqualTo("value");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user