maxOf
MaxOf is a function in the Kotlin standard library used to determine the greatest element among given values. It is designed to work with generic types and provides overloads for common use cases: two values, a vararg collection of values, and, when needed, a comparator to define a custom ordering. The function operates by selecting the maximum according to the defined ordering, without modifying the original inputs.
The basic forms include a two-value version and a vararg version. When the type parameter T implements
In addition to the two-value overloads, maxOf can be invoked with multiple values at once using the
Common usage examples include numeric values (maxOf(3, 7) -> 7) and comparable types like strings (maxOf("apple", "banana")
MaxOf is typically used alongside minOf as a pair of convenience helpers for determining extreme values in