W3cubDocs

/Kotlin

maxOf

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
fun <T : Comparable<T>> maxOf(a: T, b: T): T

Returns the greater of two values.

If values are equal, returns the first one.

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
fun maxOf(a: Byte, b: Byte): Byte
fun maxOf(a: Short, b: Short): Short
fun maxOf(a: Int, b: Int): Int
fun maxOf(a: Long, b: Long): Long

Returns the greater of two values.

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
fun maxOf(a: Float, b: Float): Float
fun maxOf(a: Double, b: Double): Double

Returns the greater of two values.

If either value is NaN, returns NaN.

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
fun <T : Comparable<T>> maxOf(a: T, b: T, c: T): T

Returns the greater of three values.

If there are multiple equal maximal values, returns the first of them.

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
fun maxOf(a: Byte, b: Byte, c: Byte): Byte
fun maxOf(a: Short, b: Short, c: Short): Short
fun maxOf(a: Int, b: Int, c: Int): Int
fun maxOf(a: Long, b: Long, c: Long): Long

Returns the greater of three values.

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
fun maxOf(a: Float, b: Float, c: Float): Float
fun maxOf(a: Double, b: Double, c: Double): Double

Returns the greater of three values.

If any value is NaN, returns NaN.

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
fun <T> maxOf(
    a: T, 
    b: T, 
    c: T, 
    comparator: Comparator<in T>
): T

Returns the greater of three values according to the order specified by the given comparator.

If there are multiple equal maximal values, returns the first of them.

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
fun <T> maxOf(a: T, b: T, comparator: Comparator<in T>): T

Returns the greater of two values according to the order specified by the given comparator.

If values are equal, returns the first one.

Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
fun <T : Comparable<T>> maxOf(a: T, vararg other: T): T

Returns the greater of the given values.

If there are multiple equal maximal values, returns the first of them.

Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
fun maxOf(a: Byte, vararg other: Byte): Byte
fun maxOf(a: Short, vararg other: Short): Short
fun maxOf(a: Int, vararg other: Int): Int
fun maxOf(a: Long, vararg other: Long): Long

Returns the greater of the given values.

Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
fun maxOf(a: Float, vararg other: Float): Float
fun maxOf(a: Double, vararg other: Double): Double

Returns the greater of the given values.

If any value is NaN, returns NaN.

Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
fun <T> maxOf(
    a: T, 
    vararg other: T, 
    comparator: Comparator<in T>
): T

Returns the greater of the given values according to the order specified by the given comparator.

If there are multiple equal maximal values, returns the first of them.

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
@ExperimentalUnsignedTypes fun maxOf(a: UInt, b: UInt): UInt
@ExperimentalUnsignedTypes fun maxOf(
    a: ULong, 
    b: ULong
): ULong
@ExperimentalUnsignedTypes fun maxOf(
    a: UByte, 
    b: UByte
): UByte
@ExperimentalUnsignedTypes fun maxOf(
    a: UShort, 
    b: UShort
): UShort

Returns the greater of two values.

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
@ExperimentalUnsignedTypes fun maxOf(
    a: UInt, 
    b: UInt, 
    c: UInt
): UInt
@ExperimentalUnsignedTypes fun maxOf(
    a: ULong, 
    b: ULong, 
    c: ULong
): ULong
@ExperimentalUnsignedTypes fun maxOf(
    a: UByte, 
    b: UByte, 
    c: UByte
): UByte
@ExperimentalUnsignedTypes fun maxOf(
    a: UShort, 
    b: UShort, 
    c: UShort
): UShort

Returns the greater of three values.

Platform and version requirements: JVM (1.4), JS (1.4), Native (1.4)
@ExperimentalUnsignedTypes fun maxOf(
    a: UInt, 
    vararg other: UInt
): UInt
@ExperimentalUnsignedTypes fun maxOf(
    a: ULong, 
    vararg other: ULong
): ULong
@ExperimentalUnsignedTypes fun maxOf(
    a: UByte, 
    vararg other: UByte
): UByte
@ExperimentalUnsignedTypes fun maxOf(
    a: UShort, 
    vararg other: UShort
): UShort

Returns the greater of the given values.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.comparisons/max-of.html