contains
Checks whether the array contains the specified element. Because it is declared as an operator function, you can use the idiomatic element in array syntax.
Signature
operator fun <T, D : Dimension> MultiArray<T, D>.contains(element: T): Boolean
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The element to search for. |
Returns: true if the element is found anywhere in the array.
Example
val a = mk.ndarray(mk[1, 2, 3, 4, 5])
a.contains(3) // true
3 in a // true (operator syntax)
10 in a // false
28 February 2026