isContaining

@JvmName(name = "arrayIsContaining")
fun <T> Validatable<Array<out T>?>.isContaining(element: T): Constraint

The validatable Array must contain element when this constraint is applied.

Code example:

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



@JvmName(name = "collectionIsContaining")
fun <T> Validatable<Collection<T>?>.isContaining(element: T): Constraint

The validatable Collection must contain element when this constraint is applied.

Code example:

val validate = Validator<Collection<Char>> { isContaining('b') }
validate(listOf('a', 'b', 'c')) // Success
validate(emptyList()) // Failure (message: Must contain "b")