Preconditions

open class Preconditions

Static convenience methods that help a method or constructor check whether it was invoked correctly.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun checkElementIndex(index: Int, size: Int)
open fun checkElementIndex(index: Int, size: Int, desc: String)
Ensures that index specifies a valid element in an array, list or string of size size.
Link copied to clipboard
open fun <T> checkNotNull(@Nullable reference: T): T
open fun <T> checkNotNull(@Nullable reference: T, errorMessage: Any): T
Ensures that an object reference passed as a parameter to the calling method is not null.
Link copied to clipboard
open fun checkState(expression: Boolean)
open fun checkState(expression: Boolean, @Nullable errorMessage: Any)
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.