arrow-core-data / arrow.core / Ior / swap

swap

fun swap(): Ior<B, A>

If this is a Left, then return the left value in Right or vice versa, when this is Both , left and right values are swap

Example:

Left("left").swap()   // Result: Right("left")
Right("right").swap() // Result: Left("right")
Both("left", "right").swap() // Result: Both("right", "left")

Do you like Arrow?

Arrow Org
<