groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (GROOVY-3880) Optional Assignment Operator
Date Wed, 01 Feb 2017 23:17:53 GMT

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

Paul King closed GROOVY-3880.
-----------------------------

> Optional Assignment Operator
> ----------------------------
>
>                 Key: GROOVY-3880
>                 URL: https://issues.apache.org/jira/browse/GROOVY-3880
>             Project: Groovy
>          Issue Type: Improvement
>          Components: syntax
>            Reporter: Michael Martz
>            Assignee: Daniel Sun
>             Fix For: 3.0
>
>
> I find myself writing a lot of code in the following form:
> if(data.field) obj.field = data.field
> // Or
> obj.field = data.field?: obj.field
> It would be nice to have a groovy operator to handle this for me.
> obj.field ?= data.field



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message