Albert
08/16/2018, 7:14 PMclass StopWatch(val startFrom: Instant) {
val elapsedTime: Long
get() = startFrom.until(Instant.now(), ChronoUnit.SECONDS)
}
What is common with this, do we want to present elapsedTime
as a property? To me pesonal it would make more sense to make it a function elapsedTime()
, this way the invoker is made aware that it might change if invoked twice without altering the object.