You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2023/12/22 11:39:01 UTC

[jira] [Closed] (GROOVY-3141) Ranges should be able to be used as Keys in Maps

     [ https://issues.apache.org/jira/browse/GROOVY-3141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-3141.
-----------------------------

> Ranges should be able to be used as Keys in Maps
> ------------------------------------------------
>
>                 Key: GROOVY-3141
>                 URL: https://issues.apache.org/jira/browse/GROOVY-3141
>             Project: Groovy
>          Issue Type: Improvement
>          Components: groovy-runtime
>            Reporter: Matthew Corby-Eaglen
>            Assignee: Jochen Theodorou
>            Priority: Minor
>
> Consider this:
> {code}
> def rangeMap = [(0..10) : "hello", (11..15) : "goodbye"]
> assertTrue(rangeMap.get(12) == "goodbye")
> {code}
> Currently you get null from the map, because 12 does not match the range as a key to the map.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)