enumEntries
Returns EnumEntries list containing all enum entries for the given enum type T.
Since Kotlin
2.0See also
Samples
import kotlin.enums.enumEntries
import kotlin.test.*
fun main() {
//sampleStart
// enum class Direction { NORTH, SOUTH, EAST, WEST }
val entries = enumEntries<Direction>()
println(entries) // [NORTH, SOUTH, EAST, WEST]
println(entries.indexOf(Direction.EAST)) // 2
println(entries[1]) // SOUTH
// enum class Empty {}
println(enumEntries<Empty>()) // []
//sampleEnd
}