arrow-core-data / arrow.core / Ior / map

map

inline fun <D> map(f: (B) -> D): Ior<A, D>

The given function is applied if this is a Right or Both to B.

Example:

Ior.Right(12).map { "flower" } // Result: Right("flower")
Ior.Left(12).map { "flower" }  // Result: Left(12)
Ior.Both(12, "power").map { "flower $it" }  // Result: Both(12, "flower power")

Do you like Arrow?

Arrow Org
<