You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Maoxiang Qian (JIRA)" <ji...@apache.org> on 2016/03/15 16:26:33 UTC

[jira] [Updated] (GROOVY-7790) Put the value in get method with default value

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

Maoxiang Qian updated GROOVY-7790:
----------------------------------
    Description: 
I'm not sure whether it was designed, but it seems to be weird.

groovy> imap=['a':1, 'b':2] 
groovy> if(imap.get('c',null)==null){ } 
groovy> imap.each{k, v -> println "${k}:${v}" } 

a:1
b:2
c:null
Result: [a:1, b:2, c:null]

  was:
I'm not sure whether it was designed, but it seems to be weird.

groovy> imap=['a':1, 'b':2] 
groovy> if(imap.get('c',null)==null){ } 
groovy> imap.each{k, v -> 
groovy>     println "${k}:${v}" 
groovy> } 
 
a:1
b:2
c:null
Result: [a:1, b:2, c:null]


> Put the value in get method with default value 
> -----------------------------------------------
>
>                 Key: GROOVY-7790
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7790
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>            Reporter: Maoxiang Qian
>
> I'm not sure whether it was designed, but it seems to be weird.
> groovy> imap=['a':1, 'b':2] 
> groovy> if(imap.get('c',null)==null){ } 
> groovy> imap.each{k, v -> println "${k}:${v}" } 
> a:1
> b:2
> c:null
> Result: [a:1, b:2, c:null]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)