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:
Arjen Poutsma
2021-04-30 15:49:00 +02:00
parent 399e7ebf22
commit b18cf3c873
2 changed files with 9 additions and 1 deletions

View File

@@ -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");
}