I'm new to Kotlin, and I'm looking for tips that rewrite the following code in a more elegant way.
val ts: Long? = 1481710060773 val date: Date? if (ts != null) { date = Date(ts) }
I tried let , but I think it is not better than the original.
val ts: Long? = 1481710060773 val date: Date? ts?.let { date = Date(ts) }
Thanks.
source share