reactor/reactor — pull request #368 by Tetradeus (2014-08-18 15:57:27+00:00)
Title: Added Promises heterogeneous when

Hi,

After playing a bit with promises, I found Promises.when very useful when playing with "homogeneous" promise (Promise of the same type and mainly of the same origin/same functional domain).

For instance, if I call x times a method returning a "Promise" with different parameters, I will join then with Promises.when to obtain a "Promise>".

But what if I would like to join "Promise" of different types and avoid to lose typed checking ?

I found the 'Tuple' version quite useful :

Promise usernamePromise = username(xxx);
Promise agePromise = username(yyy);

Promise> usernameAndAgePromise = Promises.when(usernamePromise, agePromise);

I am not very satisfied with the implementation (because lambda are not available and because I repeat a lot of code) as well as the name of the method that cannot just be "when".

I will try to improve the implementation. If you think about a great name, feel free to propose.