KotlinVersion

Common
JVM
JS
Native
1.1
class KotlinVersion : Comparable<KotlinVersion>

Represents a version of the Kotlin standard library.

major, minor and patch are integer components of a version, they must be non-negative and not greater than 255 (MAX_COMPONENT_VALUE).

Constructors

Common
JVM
JS
Native
1.0

<init>

Creates a version from major and minor components, leaving patch component zero.

KotlinVersion(major: Int, minor: Int)

Creates a version from all three components.

KotlinVersion(major: Int, minor: Int, patch: Int)

Properties

Common
JVM
JS
Native
1.0

major

val major: Int
Common
JVM
JS
Native
1.0

minor

val minor: Int
Common
JVM
JS
Native
1.0

patch

val patch: Int

Functions

Common
JVM
JS
Native
1.0

compareTo

fun compareTo(other: KotlinVersion): Int
Common
JVM
JS
Native
1.0

equals

Indicates whether some other object is "equal to" this one. Implementations must fulfil the following requirements:

fun equals(other: Any?): Boolean
Common
JVM
JS
Native
1.0

hashCode

Returns a hash code value for the object. The general contract of hashCode is:

fun hashCode(): Int
Common
JVM
JS
Native
1.0

isAtLeast

Returns true if this version is not less than the version specified with the provided major and minor components.

fun isAtLeast(major: Int, minor: Int): Boolean

Returns true if this version is not less than the version specified with the provided major, minor and patch components.

fun isAtLeast(major: Int, minor: Int, patch: Int): Boolean
Common
JVM
JS
Native
1.0

toString

Returns the string representation of this version

fun toString(): String

Companion Object Properties

Common
JVM
JS
Native
1.0

CURRENT

Returns the current version of the Kotlin standard library.

val CURRENT: KotlinVersion
Common
JVM
JS
Native
1.0

MAX_COMPONENT_VALUE

Maximum value a version component can have, a constant value 255.

const val MAX_COMPONENT_VALUE: Int

Extension Functions

Common
JVM
JS
Native
1.0

coerceAtLeast

Ensures that this value is not less than the specified minimumValue.

fun <T : Comparable<T>> T.coerceAtLeast(minimumValue: T): T
Common
JVM
JS
Native
1.0

coerceAtMost

Ensures that this value is not greater than the specified maximumValue.

fun <T : Comparable<T>> T.coerceAtMost(maximumValue: T): T
Common
JVM
JS
Native
1.0

coerceIn

Ensures that this value lies in the specified range minimumValue..maximumValue.

fun <T : Comparable<T>> T.coerceIn(
    minimumValue: T?,
    maximumValue: T?
): T

Ensures that this value lies in the specified range.

fun <T : Comparable<T>> T.coerceIn(
    range: ClosedFloatingPointRange<T>
): T
fun <T : Comparable<T>> T.coerceIn(range: ClosedRange<T>): T
Common
JVM
JS
Native
1.0

rangeTo

Creates a range from this Comparable value to the specified that value.

operator fun <T : Comparable<T>> T.rangeTo(
    that: T
): ClosedRange<T>