Created
July 25, 2014 19:10
-
-
Save weefbellington/46e53cdb312d3a871ad3 to your computer and use it in GitHub Desktop.
parallel promises example
This file contains hidden or 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
Promise<ResponseTypeA> responseA; | |
Promise<ResponseTypeB> responseB; | |
p1.then(new PromiseAction<A>() { | |
public void call(A response) { | |
// do something with the response | |
} | |
}); | |
p2.then(new PromiseAction<B>() { | |
public void call(B value) { | |
// do something with the response | |
} | |
}); | |
p1.and(p2).then(new PromiseAction<A, B>) { | |
public void call(A responseA, B responseB) { | |
// compute something that needs both values | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment