union

Common
JVM
JS
Native
1.0
infix fun <T> Array<out T>.union(other: Iterable<T>): Set<T>
(source)
infix fun ByteArray.union(other: Iterable<Byte>): Set<Byte>
(source)
infix fun ShortArray.union(
    other: Iterable<Short>
): Set<Short>

(source)
infix fun IntArray.union(other: Iterable<Int>): Set<Int>
(source)
infix fun LongArray.union(other: Iterable<Long>): Set<Long>
(source)
infix fun FloatArray.union(
    other: Iterable<Float>
): Set<Float>

(source)
infix fun DoubleArray.union(
    other: Iterable<Double>
): Set<Double>

(source)
infix fun BooleanArray.union(
    other: Iterable<Boolean>
): Set<Boolean>

(source)
infix fun CharArray.union(other: Iterable<Char>): Set<Char>
(source)

Returns a set containing all distinct elements from both collections.

The returned set preserves the element iteration order of the original array. Those elements of the other collection that are unique are iterated in the end in the order of the other collection.

To get a set containing all elements that are contained in both collections use intersect.

Common
JVM
JS
Native
1.0
infix fun <T> Iterable<T>.union(other: Iterable<T>): Set<T>
(source)

Returns a set containing all distinct elements from both collections.

The returned set preserves the element iteration order of the original collection. Those elements of the other collection that are unique are iterated in the end in the order of the other collection.

To get a set containing all elements that are contained in both collections use intersect.