mirror of
https://github.com/corda/corda.git
synced 2025-01-29 15:43:55 +00:00
Minor: add an "until" infix function that applies to Temporal's ... the primary purpose of this beyond a trivial bit of extra readability, is null safety.
This commit is contained in:
parent
2190fbf2ee
commit
5f8dec4ff9
@ -14,6 +14,7 @@ import com.google.common.util.concurrent.SettableFuture
|
||||
import org.slf4j.Logger
|
||||
import java.security.SecureRandom
|
||||
import java.time.Duration
|
||||
import java.time.temporal.Temporal
|
||||
import java.util.concurrent.Executor
|
||||
|
||||
val Int.days: Duration get() = Duration.ofDays(this.toLong())
|
||||
@ -40,4 +41,7 @@ fun <T> SettableFuture<T>.setFrom(logger: Logger? = null, block: () -> T): Setta
|
||||
setException(e)
|
||||
}
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
// Simple infix function to add back null safety that the JDK lacks: timeA until timeB
|
||||
infix fun Temporal.until(endExclusive: Temporal) = Duration.between(this, endExclusive)
|
Loading…
x
Reference in New Issue
Block a user