Created
November 14, 2017 13:56
-
-
Save twogood/41d10109a4bc6b5daf7b038bc5308a45 to your computer and use it in GitHub Desktop.
Create ListenableFuture<Pair<A, B>> from ListenableFuture<A> and ListenableFuture<B>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <A, B> transformAsyncPair(futureA: ListenableFuture<A>, futureB: ListenableFuture<B>, executor: Executor): ListenableFuture<Pair<A, B>> { | |
return Futures.transformAsync(futureA, AsyncFunction<A, Pair<A, B>> { a -> | |
Futures.transformAsync(futureB, AsyncFunction<B, Pair<A, B>> { b -> | |
Futures.immediateFuture(Pair<A, B>(a!!, b!!)) | |
}, executor) | |
}, executor) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment