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 = "iterableIsContaining")
fun <T> Validatable<Iterable<T>?>.isContaining(element: T): Constraint

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

Code example:

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