intersect

infix fun <T> Array<out T>.intersect(other: Iterable<T>): Set<T>(source)
infix fun IntArray.intersect(other: Iterable<Int>): Set<Int>(source)

Returns a set containing all elements that are contained by both this array and the specified collection.

The returned set preserves the element iteration order of the original array.

To get a set containing all elements that are contained at least in one of these collections use union.

Since Kotlin

1.0

infix fun <T> Iterable<T>.intersect(other: Iterable<T>): Set<T>(source)

Returns a set containing all elements that are contained by both this collection and the specified collection.

The returned set preserves the element iteration order of the original collection.

To get a set containing all elements that are contained at least in one of these collections use union.

Since Kotlin

1.0