setOf

external fun <T> setOf(vararg elements: T): Set<T>(source)

Creates a fresh read-only set containing the distinct supplied elements.

Uses HashSet storage. Equal elements coalesce, retaining the first stored element. Arguments are evaluated once in source order before population performs hashing or equality. Iteration order is unspecified. Read-only access does not make the underlying set immutable. Guest Kotlin supports direct vararg arguments; spread arguments remain unavailable.

Return

a new set, empty when no elements are supplied.

Parameters

elements

values to insert in argument order.

Type Parameters

T

element type.

See also