Introduce minOrNull and maxOrNull extension functions #KT-39064

This commit is contained in:
Abduqodiri Qurbonzoda
2020-05-20 04:56:52 +03:00
parent a8cd8ad8f8
commit 846a7823ad
14 changed files with 928 additions and 612 deletions
@@ -394,14 +394,14 @@ abstract class IterableTests<T : Iterable<String>>(val createFrom: (Array<out St
}
@Test
fun max() {
expect("foo") { data.max() }
fun maxOrNull() {
expect("foo") { data.maxOrNull() }
expect("bar") { data.maxBy { it.last() } }
}
@Test
fun min() {
expect("bar") { data.min() }
fun minOrNull() {
expect("bar") { data.minOrNull() }
expect("foo") { data.minBy { it.last() } }
}