atMost

fun <T : Comparable<T>> T.atMost(max: T): T(source)

Returns this value or max, whichever is smaller.