Comparable
Classes which inherit from this interface have a defined total ordering between their instances.
Functions
Extension Functions
coerceAtLeast
Ensures that this value is not less than the specified minimumValue.
fun <T : Comparable<T>> T.coerceAtLeast(minimumValue: T): T
coerceAtMost
Ensures that this value is not greater than the specified maximumValue.
fun <T : Comparable<T>> T.coerceAtMost(maximumValue: T): T
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
rangeTo
Creates a range from this Comparable value to the specified that value.
operator fun <T : Comparable<T>> T.rangeTo(
that: T
): ClosedRange<T>
Inheritors
Boolean
Represents a value which is either true
or false
. On the JVM, non-nullable values of this type are
represented as values of the primitive type boolean
.
class Boolean : Comparable<Boolean>
Byte
Represents a 8-bit signed integer.
On the JVM, non-nullable values of this type are represented as values of the primitive type byte
.
class Byte : Number, Comparable<Byte>
Char
Represents a 16-bit Unicode character.
class Char : Comparable<Char>
Double
Represents a double-precision 64-bit IEEE 754 floating point number.
On the JVM, non-nullable values of this type are represented as values of the primitive type double
.
class Double : Number, Comparable<Double>
Duration
Represents the amount of time one instant of time is away from another instant.
class Duration : Comparable<Duration>
Enum
The common base class of all enum classes. See the Kotlin language documentation for more information on enum classes.
abstract class Enum<E : Enum<E>> : Comparable<E>
class Enum<T : Enum<T>> : Comparable<Enum<T>>
Float
Represents a single-precision 32-bit IEEE 754 floating point number.
On the JVM, non-nullable values of this type are represented as values of the primitive type float
.
class Float : Number, Comparable<Float>
Int
Represents a 32-bit signed integer.
On the JVM, non-nullable values of this type are represented as values of the primitive type int
.
class Int : Number, Comparable<Int>
KotlinVersion
Represents a version of the Kotlin standard library.
class KotlinVersion : Comparable<KotlinVersion>
Long
Represents a 64-bit signed integer.
On the JVM, non-nullable values of this type are represented as values of the primitive type long
.
class Long : Number, Comparable<Long>
Short
Represents a 16-bit signed integer.
On the JVM, non-nullable values of this type are represented as values of the primitive type short
.
class Short : Number, Comparable<Short>
String
The String
class represents character strings. All string literals in Kotlin programs, such as "abc"
, are
implemented as instances of this class.
class String : Comparable<String>, CharSequence
UByte
class UByte : Comparable<UByte>
UInt
class UInt : Comparable<UInt>
ULong
class ULong : Comparable<ULong>
UShort
class UShort : Comparable<UShort>