sdk-common / com.tomtom.online.sdk.common.functional / Try / zipWith

zipWith

@NonNull abstract fun <R : Any!, S : Any!> zipWith(@NonNull other: Try<out S>, @NonNull zipper: (in T, in S) -> out R): Try<R>

Returns an instance of Try that contains the result of the specified zipper function applied to the values of both Try instances if both are a Success. If at least one instance is a Failure or the zipper function fails then z Failure is returned.

Parameters

other - Try<out S>: holds value which needs to be zipped.

zipper - (in T, in S) -> out R: function used for zipping values in both Try instances

- type of the value wrapped in Try

- type of the value wrapped in the zipped Try

Return
Try<R>: Success if both instances are a Success and zipper function doesn't fail, Failure otherwise.