arrow-core-data / arrow.core / Either / exists

exists

fun exists(predicate: (B) -> Boolean): Boolean

Returns false if Left or returns the result of the application of the given predicate to the Right value.

Example:

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

val left: Either<Int, Int> = Left(12)
left.exists { it > 10 }      // Result: false

Do you like Arrow?

Arrow Org
<