contains

fun <A, B> Either<A, B>.contains(elem: B): 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 Prefer the Either DSL, or replace with explicit fold

Replace with

fold({ false }) { it == elem }

Returns true if this is a Right and its value is equal to elem (as determined by ==), returns false otherwise.

Example:

import arrow.core.Either.Right
import arrow.core.Either.Left
import arrow.core.contains

fun main() {
Right("something").contains("something") // Result: true
Right("something").contains("anything") // Result: false
Left("something").contains("something") // Result: false
}

Return

true if the option has an element that is equal (as determined by ==) to elem, false otherwise.

Parameters

elem

the element to test.