toHashSet

Returns a new HashSet of all elements.

fun <T> Array<out T>.toHashSet(): HashSet<T>(source)
fun main() {
    val array = arrayOf("apple", "banana", "apple", "orange")
    val set = array.toHashSet()
    println(set) // [apple, banana, orange]
}

Source