W3cubDocs

/Kotlin

union

infix fun <T> Array<out T>.union(other: Iterable<T>): Set<T>
infix fun ByteArray.union(other: Iterable<Byte>): Set<Byte>
infix fun ShortArray.union(
    other: Iterable<Short>
): Set<Short>
infix fun IntArray.union(other: Iterable<Int>): Set<Int>
infix fun LongArray.union(other: Iterable<Long>): Set<Long>
infix fun FloatArray.union(
    other: Iterable<Float>
): Set<Float>
infix fun DoubleArray.union(
    other: Iterable<Double>
): Set<Double>
infix fun BooleanArray.union(
    other: Iterable<Boolean>
): Set<Boolean>
infix fun CharArray.union(other: Iterable<Char>): Set<Char>

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.

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

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.

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/union.html