findOrNull

inline fun findOrNull(predicate: (A) -> Boolean): A?

Deprecated

This API is niche and will be removed in the future. If this method is crucial for you, please let us know on the Arrow Github. Thanks! https://github.com/arrow-kt/arrow/issues Prefer Kotlin nullable syntax instead

Replace with

getOrNull()?.takeIf(predicate)

Returns the $option's value if this option is nonempty '''and''' the predicate $p returns true when applied to this $option's value. Otherwise, returns null.

Example:

import arrow.core.Some
import arrow.core.None
import arrow.core.Option

fun main() {
Some(12).exists { it 10 } // Result: 12
Some(7).exists { it 10 } // Result: null

val none: Option<Int> = None
none.exists { it 10 } // Result: null
}