RFR: JDK-8323760 putIfAbsent documentation conflicts with itself [v2]
Jonathan Gibbons
jjg at openjdk.org
Wed Feb 14 15:20:05 UTC 2024
On Tue, 13 Feb 2024 17:11:05 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> Update the documentation for `@return` tag of `putIfAbsent` to match the main description. `putIfAbsent` uses the same wording as `put` for its `@return` tag, but that is incorrect. `putIfAbsent` never returns the **previous** value, as the whole point of the method is not the replace the value if it was present. As such, if it returns a value, it is the **current** value, and in all other cases it will return `null`.
>
> John Hendrikx has updated the pull request incrementally with four additional commits since the last revision:
>
> - Add code block around argument
> - Reword
> - Reword to use put's previous value wording
> - Reword more clearly
src/java.base/share/classes/java/util/Map.java line 824:
> 822: * {@code null} return can also indicate that the map previously
> 823: * associated {@code null} with the key, if the implementation supports
> 824: * null values.)
inconsistent typography for `null`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17438#discussion_r1489648755
More information about the core-libs-dev
mailing list