On Fri, 6 Nov 2026 18:45:33 GMT, Stuart Marks <[email protected]> wrote:

>> It is not right to ask an intentional user of `contains` to migrate to 
>> `containsKey`.
>
> Hm, well there is the possibility that the user has come here because they're 
> not sure what `contains` actually does. And the text does read a bit 
> awkwardly in that it mentions the possibilities of both key and value but 
> then only refers to `containsValue`. How about this instead:
> 
>> This method is potentially confusing because its name does not indicate
>> whether it checks for the presence of a key or a value. Use
>> {@link #containsValue(Object) containsValue} in preference to this method, 
>> or use
>> {@link #containsKey(Object) containsKey} to check for the presence of a key.

In this case I would restore "this is extremely confusing with containsKey" 
text  without the collection references.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/33593#discussion_r4498719536

Reply via email to