Details
Description
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
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
more like ?:= instead of ?= I would say...
but it does not allign well with other operations normally you have a = a op b and you make a op= b out of it. That means the part I assign to comes first. Now in what you want the order is exaclty the other way around.