Skip to content
This repository was archived by the owner on Nov 11, 2021. It is now read-only.

Commit 4c90fd4

Browse files
author
LepilkinaElena
authored
Fix minBy/maxBy usages (Kotlin#2636)
1 parent b61a66c commit 4c90fd4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

kotlinx-coroutines-core/common/test/flow/VirtualTime.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ internal class VirtualTimeDispatcher(enclosingScope: CoroutineScope) : Coroutine
2626
?: error("Event loop is missing, virtual time source works only as part of event loop")
2727
if (delayNanos <= 0) continue
2828
if (delayNanos > 0 && delayNanos != Long.MAX_VALUE) error("Unexpected external delay: $delayNanos")
29-
val nextTask = heap.minBy { it.deadline } ?: return@launch
29+
val nextTask = heap.minByOrNull { it.deadline } ?: return@launch
3030
heap.remove(nextTask)
3131
currentTime = nextTask.deadline
3232
nextTask.run()

kotlinx-coroutines-test/src/internal/MainTestDispatcher.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ internal class TestMainDispatcherFactory : MainDispatcherFactory {
6464
override fun createDispatcher(allFactories: List<MainDispatcherFactory>): MainCoroutineDispatcher {
6565
val originalFactory = allFactories.asSequence()
6666
.filter { it !== this }
67-
.maxBy { it.loadPriority } ?: MissingMainCoroutineDispatcherFactory
67+
.maxByOrNull { it.loadPriority } ?: MissingMainCoroutineDispatcherFactory
6868
return TestMainDispatcher(originalFactory)
6969
}
7070

0 commit comments

Comments
 (0)