Danish Ansari
11/21/2021, 8:03 AMkotlin.math.max()
and kotlin.comparisons.maxOf()
? Both of them seem to be doing the same thing.
2 things I noticed that the later one can compare 3 values also and we can also pass our own comparator. Any other difference than these?Richard Gomez
11/21/2021, 8:32 AMmax
is an alias of java.lang.Math
on the JVM.
https://github.com/JetBrains/kotlin/blob/92d200e093c693b3c06e53a39e0b0973b84c7ec5/libraries/stdlib/jvm/src/kotlin/util/MathJVM.kt#L464
maxOf
seems to just call Math.max 🤔:
https://github.com/JetBrains/kotlin/blob/92d200e093c693b3c06e53a39e0b0973b84c7ec5/libraries/stdlib/jvm/src/generated/_ComparisonsJvm.kt#L24ephemient
11/21/2021, 1:39 PMephemient
11/21/2021, 1:44 PMZach Klippenstein (he/him) [MOD]
11/22/2021, 4:39 PM