vinicius.rob.cunha
05/05/2017, 2:16 PMread.cutOn != meterCut && (meter.cutDate != null || readDate.after(meter.cutDate))
janvladimirmostert
05/05/2017, 2:22 PM(meter.cutDate != null || readDate.after(meter.cutDate))
Does the logic mean, if meter.cutDate
is null
, do a readDate.after(null)
?
Not sure I follow the logicjanvladimirmostert
05/05/2017, 2:24 PM&&
instead, then it would be possible to simplify it.vinicius.rob.cunha
05/05/2017, 2:25 PM== null
instead of != null
vinicius.rob.cunha
05/05/2017, 2:26 PMread.cutOn != meterCut && (meter.cutDate == null || readDate.after(meter.cutDate))
janvladimirmostert
05/05/2017, 2:34 PMlet
should help here:
Haven’t tested this code, try it first:
meter.cutDate?.let { readDate.after(it) } ?: true
janvladimirmostert
05/05/2017, 2:34 PMvinicius.rob.cunha
05/05/2017, 2:49 PMjanvladimirmostert
05/05/2017, 2:51 PMlet
leosan
05/05/2017, 2:53 PMthen
which is a more readable let
janvladimirmostert
05/05/2017, 3:00 PMthen
. Kinda hard Google for an example when it’s such a common word.leosan
05/05/2017, 3:35 PMalso
😛 as meter.cutDate?.also{ readDate.after(it) } ?: true
elect
05/08/2017, 12:27 PMthen