Preconditions

object Preconditions

Simple static methods to be called at the start of your own methods to verify correct arguments and state.

Functions

checkArgument
Link copied to clipboard
fun checkArgument(expression: Boolean, errorMessage: Any)
Ensures that an expression checking an argument is true.
checkArgumentNonnegative
Link copied to clipboard
@IntRange(from = 0.toLong())
fun checkArgumentNonnegative(value: Int): Int
Ensures that that the argument numeric value is non-negative.
checkNotNull
Link copied to clipboard
fun <T> checkNotNull(reference: T?): T
Ensures that an object reference passed as a parameter to the calling method is not null.