intersect
Returns a Set of elements that are present in both the array and the given iterable. Uses the infix syntax array intersect collection.
Signature
infix fun <T, D : Dimension> MultiArray<T, D>.intersect(
other: Iterable<T>
): Set<T>
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The collection to intersect with. |
Returns: Set<T> — elements that appear in both the array and other.
Example
val a = mk.ndarray(mk[1, 2, 3, 4, 5])
a intersect listOf(3, 4, 5, 6, 7) // {3, 4, 5}
a intersect listOf(10, 20) // {}
28 February 2026