toEnumSet

inline fun <E : Enum<E>> Set<E>.toEnumSet(): Set<E>(source)

Copies a regular Set into a set optimized for enumerations.

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

Example

enum class Foo {
A,
B,
C,
}

val foo = setOf(Foo.A, Foo.B).toEnumSet()