hasNoDuplicates

The validatable Array must contain unique elements when this constraint is applied.

Code example:

val validate = Validator<Array<Char>> { hasNoDuplicates() }
validate(arrayOf('a', 'b', 'c')) // Success
validate(arrayOf('a', 'b', 'c', 'a')) // Failure (message: Must contain unique elements)

The validatable Iterable must contain unique elements when this constraint is applied.

Code example:

val validate = Validator<Iterable<Char>> { hasNoDuplicates() }
validate(listOf('a', 'b', 'c')) // Success
validate(listOf('a', 'b', 'c', 'a')) // Failure (message: Must contain unique elements)