exists

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

Deprecated

This API is considered redundant. If this method is crucial for you, please let us know on the Arrow Github. Thanks! https://github.com/arrow-kt/arrow/issues Please use Option's member function isSome. This will be removed towards Arrow 2.0

Replace with

isSome(predicate)

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

Example:

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

fun main() {
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