//arrow-core/arrow.core/contains

contains

common fun <A, B> Either<A, B>.contains(elem: B): Boolean

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

common

   
elem the element to test.

Do you like Arrow?

Arrow Org
<