Skip to content

enumSetOf

inline fun <E : Enum<E>> enumSetOf(vararg elements: E): Set<E>

inline fun <E : Enum<E>> enumSetOf(elements: Iterable<E>): Set<E>

Creates a Set optimized for storing elements of enumerations.

Depending on the enumeration size, different implementations may be returned.

Example

enum class Foo {
    A,
    B,
    C,
}

val foo = enumSetOf(Foo.A, Foo.B)