Enum

abstract class Enum<E : Enum<E>>(val name: String, val ordinal: Int) : Comparable<E> (source)

Since Kotlin

1.1

Inheritors

abstract class Enum<E : Enum<E>>(val name: String, val ordinal: Int) : Comparable<E> (source)

The common base class of all enum classes. See the Kotlin language documentation for more information on enum classes.

Since Kotlin

1.3

Inheritors

abstract class Enum<E : Enum<E>>(val name: String, val ordinal: Int) : Comparable<E> (source)

Since Kotlin

1.8

Inheritors

abstract class Enum<E : Enum<E>>(val name: String, val ordinal: Int) : Comparable<E> (source)

Since Kotlin

1.8

Inheritors

Constructors

Link copied to clipboard
constructor(name: String, ordinal: Int)
constructor(name: String, ordinal: Int)
constructor(name: String, ordinal: Int)
constructor(name: String, ordinal: Int)
constructor(name: String, ordinal: Int)

Types

Link copied to clipboard
object Companion
Since Kotlin 1.0
object Companion
Since Kotlin 1.1
object Companion
Since Kotlin 1.3
object Companion
Since Kotlin 1.8
object Companion
Since Kotlin 1.8

Properties

Link copied to clipboard

Returns a Java Class instance of the enum the given constant belongs to.

Since Kotlin 1.7
Link copied to clipboard

Returns the name of this enum constant, exactly as declared in its enum declaration.

Since Kotlin 1.0
Since Kotlin 1.1
Since Kotlin 1.3
Since Kotlin 1.8
Since Kotlin 1.8
Link copied to clipboard

Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).

Since Kotlin 1.0
Since Kotlin 1.1
Since Kotlin 1.3
Since Kotlin 1.8
Since Kotlin 1.8

Functions

Link copied to clipboard
protected fun clone(): Any

Throws an exception since enum constants cannot be cloned. This method prevents enum classes from inheriting from Cloneable.

Since Kotlin 1.0
Link copied to clipboard
operator override fun compareTo(other: E): Int

Compares this object with the specified object for order. Returns zero if this object is equal to the specified other object, a negative number if it's less than other, or a positive number if it's greater than other.

Since Kotlin 1.0
operator override fun compareTo(other: E): Int

Compares this object with the specified object for order. Returns zero if this object is equal to the specified other object, a negative number if it's less than other, or a positive number if it's greater than other.

Since Kotlin 1.1
operator override fun compareTo(other: E): Int

Compares this object with the specified object for order. Returns zero if this object is equal to the specified other object, a negative number if it's less than other, or a positive number if it's greater than other.

Since Kotlin 1.3
open operator override fun compareTo(other: E): Int

Compares this object with the specified object for order. Returns zero if this object is equal to the specified other object, a negative number if it's less than other, or a positive number if it's greater than other.

Since Kotlin 1.8
open operator override fun compareTo(other: E): Int

Compares this object with the specified object for order. Returns zero if this object is equal to the specified other object, a negative number if it's less than other, or a positive number if it's greater than other.

Since Kotlin 1.8
Link copied to clipboard
infix inline fun <T> Comparable<T>.compareTo(other: T): Int

Compares this object with the specified object for order. Returns zero if this object is equal to the specified other object, a negative number if it's less than other, or a positive number if it's greater than other.

Since Kotlin 1.6
Link copied to clipboard
operator override fun equals(other: Any?): Boolean
Since Kotlin 1.0
operator override fun equals(other: Any?): Boolean
Since Kotlin 1.1
operator override fun equals(other: Any?): Boolean
Since Kotlin 1.3
Link copied to clipboard
override fun hashCode(): Int
Since Kotlin 1.0
override fun hashCode(): Int
Since Kotlin 1.1
override fun hashCode(): Int
Since Kotlin 1.3
Link copied to clipboard
open override fun toString(): String
Since Kotlin 1.0
open override fun toString(): String
Since Kotlin 1.1
open override fun toString(): String
Since Kotlin 1.3
open override fun toString(): String
Since Kotlin 1.8
open override fun toString(): String
Since Kotlin 1.8