Enum

expect abstract class Enum<E : Enum<E>>(name: String, 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.0

Inheritors

actual 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>>(name: String, 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.0

Inheritors

actual 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

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

Since Kotlin

1.8

Inheritors

actual 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
expect constructor(name: String, ordinal: Int)
actual constructor(name: String, ordinal: Int)
constructor(name: String, ordinal: Int)
actual constructor(name: String, ordinal: Int)
actual constructor(name: String, ordinal: Int)
actual constructor(name: String, ordinal: Int)

Types

Link copied to clipboard
expect object Companion
Since Kotlin 1.0
actual object Companion
Since Kotlin 1.1
object Companion
Since Kotlin 1.0
actual object Companion
Since Kotlin 1.3
actual object Companion
Since Kotlin 1.8
actual 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
expect val name: String

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

Since Kotlin 1.0
actual val name: String
Since Kotlin 1.1

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

Since Kotlin 1.0
actual val name: String
Since Kotlin 1.3
actual val name: String
Since Kotlin 1.8
actual val name: String
Since Kotlin 1.8
Link copied to clipboard
expect val ordinal: Int

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
actual val ordinal: Int
Since Kotlin 1.1

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
actual val ordinal: Int
Since Kotlin 1.3
actual val ordinal: Int
Since Kotlin 1.8
actual val ordinal: Int
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
expect 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
actual 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.0
actual 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
actual operator override fun compareTo(other: E): Int
Since Kotlin 1.8
actual operator override fun compareTo(other: E): Int
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
expect operator override fun equals(other: Any?): Boolean
Since Kotlin 1.0
actual operator override fun equals(other: Any?): Boolean
Since Kotlin 1.1
operator override fun equals(other: Any?): Boolean
Since Kotlin 1.0
actual operator override fun equals(other: Any?): Boolean
Since Kotlin 1.3
actual operator override fun equals(other: Any?): Boolean
Since Kotlin 1.8
actual operator override fun equals(other: Any?): Boolean
Since Kotlin 1.8
Link copied to clipboard
expect override fun hashCode(): Int
Since Kotlin 1.0
actual override fun hashCode(): Int
Since Kotlin 1.1
override fun hashCode(): Int
Since Kotlin 1.0
actual override fun hashCode(): Int
Since Kotlin 1.3
actual override fun hashCode(): Int
Since Kotlin 1.8
actual override fun hashCode(): Int
Since Kotlin 1.8
Link copied to clipboard
expect open override fun toString(): String
Since Kotlin 1.0
actual open override fun toString(): String
Since Kotlin 1.1
open override fun toString(): String
Since Kotlin 1.0
actual open override fun toString(): String
Since Kotlin 1.3
actual open override fun toString(): String
Since Kotlin 1.8
actual open override fun toString(): String
Since Kotlin 1.8