isEmpty

@JvmName(name = "arrayIsEmpty")
fun <T> Validatable<Array<out T>?>.isEmpty(): Constraint

The validatable Array must be empty when this constraint is applied.

Code example:

val validate = Validator<Array<Char>> { isNotEmpty() }
validate(arrayOf('a', 'b', 'c')) // Success
validate(emptyArray()) // Failure (message: Must not be empty)



@JvmName(name = "collectionIsEmpty")
fun <T> Validatable<Collection<T>?>.isEmpty(): Constraint

The validatable Collection must be empty when this constraint is applied.

Code example:

val validate = Validator<Collection<Char>> { isNotEmpty() }
validate(listOf('a', 'b', 'c')) // Success
validate(emptyList()) // Failure (message: Must not be empty)

@JvmName(name = "mapIsEmpty")
fun <T> Validatable<Map<*, T>?>.isEmpty(): Constraint

The validatable Map must be empty when this constraint is applied.

Code example:

val validate = Validator<Map<Char, Int>> { isNotEmpty() }
validate(mapOf('a' to 1, 'b' to 2, 'c' to 3)) // Success
validate(emptyMap()) // Failure (message: Must not be empty)