hasSizeLowerThan

@JvmName(name = "arrayHasSizeLowerThan")
fun <T> Validatable<Array<out T>?>.hasSizeLowerThan(size: Int): Constraint

The validatable Array must have a size lower than size when this constraint is applied.

Code example:

val validate = Validator<Array<Char>> { hasSizeLowerThan(3) }
validate(arrayOf('a', 'b')) // Success
validate(arrayOf('a', 'b', 'c')) // Failure (message: The number of items must be lower than 3)

@JvmName(name = "collectionHasSizeLowerThan")
fun <T> Validatable<Collection<T>?>.hasSizeLowerThan(size: Int): Constraint

The validatable Collection must have a size lower than size when this constraint is applied.

Code example:

val validate = Validator<Collection<Char>> { hasSizeLowerThan(3) }
validate(listOf('a', 'b')) // Success
validate(listOf('a', 'b', 'c')) // Failure (message: The number of items must be lower than 3)

@JvmName(name = "mapHasSizeLowerThan")
fun <T> Validatable<Map<*, T>?>.hasSizeLowerThan(size: Int): Constraint

The validatable Map must have a size lower than size when this constraint is applied.

Code example:

val validate = Validator<Map<Char, Int>> { hasSizeLowerThan(3) }
validate(mapOf('a' to 1, 'b' to 2)) // Success
validate(mapOf('a' to 1, 'b' to 2, 'c' to 3)) // Failure (message: The number of items must be lower than 3)