isEmpty
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)
Content copied to clipboard
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)
Content copied to clipboard
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)
Content copied to clipboard