arrow-core-data / arrow.core / Option / exists

exists

inline fun exists(predicate: (A) -> Boolean): Boolean

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

Example:

Some(12).exists { it > 10 } // Result: true
Some(7).exists { it > 10 }  // Result: false

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

Parameters

predicate - the predicate to test

Do you like Arrow?

Arrow Org
<