Hi, here’s how the code I previously posted looks like with JDK 1.6:
final List<String> idsNotFound = new ArrayList<String>();
Observable.from(ids).flatMap(new Func1<String, Observable<? extends JsonDocument>>() {
@Override
public Observable<? extends JsonDocument> call(String id) {
return dsBucket.async().get(id).switchIfEmpty(dsBucket.async().get(doSomethingwithId(id)))
.defaultIfEmpty(null).filter(new Func1<JsonDocument, Boolean>() {
@Override
public Boolean call(JsonDocument doc) {
if (doc == null) {
idsNotFound.add(id);
return false;
} else {
return true;
}
}
});
}
}).toList().toBlocking().single();