[
https://issues.apache.org/jira/browse/GROOVY-9848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17733903#comment-17733903
]
Paul King commented on GROOVY-9848:
-----------------------------------
I am not sure it is a case of being aligned. Lists don't have keys or values.
List isCase is implemented in terms of "contains". There is no direct
"contains" for Map. Options are "containsValue", "containsKey" and the current
"containsKey pointing to truth value". The current behavior makes this code:
if (val in map) // do something case 1
equivalent to this:
if (map[val]) // do something case 2
If we don't like the above and want the case 1 to be equivalent instead to:
if (map.containsKey(val)) // do something case 3
Then, while not aligned with List, it might be an argument to make the change.
Cheers, Paul.
> Allow membership operator to work on maps
> -----------------------------------------
>
> Key: GROOVY-9848
> URL: https://issues.apache.org/jira/browse/GROOVY-9848
> Project: Groovy
> Issue Type: Improvement
> Reporter: Keegan Witt
> Priority: Major
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)