Skip to content

Commit f3bdd56

Browse files
bradynpoulsenqwwdfsad
authored andcommitted
Updated firstOrNull with Any lower bound
1 parent 26e2d88 commit f3bdd56

File tree

1 file changed

+1
-1
lines changed
  • kotlinx-coroutines-core/common/src/flow/terminal

1 file changed

+1
-1
lines changed

kotlinx-coroutines-core/common/src/flow/terminal/Reduce.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public suspend fun <T> Flow<T>.firstOrNull(): T? {
142142
* The terminal operator that returns the first element emitted by the flow and then cancels flow's collection.
143143
* Returns [null] if the flow did not contain an element matching the [predicate].
144144
*/
145-
public suspend fun <T> Flow<T>.firstOrNull(predicate: suspend (T) -> Boolean): T? {
145+
public suspend fun <T : Any> Flow<T>.firstOrNull(predicate: suspend (T) -> Boolean): T? {
146146
var result: Any? = NULL
147147
try {
148148
collect { value ->

0 commit comments

Comments
 (0)