Ordered multiple async get

Is there any way to perform a multiple async get and get a result preserving the order of the provided keys?

For example:
List keys = Arrays.asList(“key:1”,“key:2”, “key:3”);
List documents = Observable
.from(keys)
.flatMap(new Func1<String, Observable>() {
@Override
public Observable call(String key) {
return getBucket().async().get(key);
}
})
.toList()
.toBlocking()
.single();

document results do not respect any order because it is populated asynchronously.

Hi,

That would be a little against the point of making one async multiple get. You to be sure you get everything in order, you would have to block on the first one then get the second one. Or wait until you have everything and sort it. Some Rx operators should be available to do this.

use concatMap instead of flatMap, since it doesn’t guarantee the ordering.