Comparable
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
compareTo
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.
infix fun <T> Comparable<T>.compareTo(other: T): Int
rangeTo
Creates a range from this Comparable value to the specified that value.
operator fun <T : Comparable<T>> T.rangeTo(
that: T
): ClosedRange<T>
rangeUntil
Creates an open-ended range from this Comparable value to the specified that value.
operator fun <T : Comparable<T>> T.rangeUntil(
that: T
): OpenEndRange<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.
On the JVM, non-nullable values of this type are represented as values of the primitive type char
.
class Char : Comparable<Char>
ComparableTimeMark
A TimeMark that can be compared for difference with other time marks obtained from the same TimeSource.WithComparableMarks time source.
interface ComparableTimeMark :
TimeMark,
Comparable<ComparableTimeMark>
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>
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>