map2

fun <E, U, V, W> map2(left: Result<E, U>, right: Result<E, V>, transform: (U, V) -> W): Result<E, W>

Map over two results.

Accepts two results and transform their successes into a result.

Return

the result of applying transform to the success values of left and right. If left is a Failure return that failure. Otherwise if right is a Failure return that failure.

See also

Parameters

left

the Result on the left.

U

the value type of the left result.

right

the Result on the right.

V

the value type of the right result.

transform

a transforms of two arguments of type U and V to an instance of type W.

W

the value type of the returned result.

E

the common error type of the results involved.