tapchicoma
01/12/2018, 7:01 AMnullableValue = NullableValue(1, 2, 3)
nullableValue?.someProperty = 4
or 2️⃣ :
nullableValue = NullableValue(1, 2, 3).apply {
someProperty = 4
}
where NullableValue
constructor has a lot of params.dave08
01/14/2018, 9:09 AM?.apply
?tapchicoma
01/15/2018, 8:50 AMNullableValue()
is a constructor of object. Example is a little misleading (dave08
01/15/2018, 10:08 AM?.
? Could you show the implementation?tapchicoma
01/15/2018, 10:37 AMnullableValue
defined as class property: var nullableValue: NullableValue? = null
bdawg.io
01/15/2018, 9:08 PMapply
when you’re wanting to call additional methods/properties immediately following the constructor. One potential advantage also being you now have context to the full type returned by the method instead of relying on the potentially more generic property being set to