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