Here i my sample code which returns list of JsonDocument
from couchbase server.
Cluster cluster = CouchbaseCluster.create();
Bucket bucket = cluster.openBucket();
List<JsonDocument> foundDocs = Observable
.just("key1", "key2", "key3", "key4", "key5")
.flatMap(new Func1<String, Observable<JsonDocument>>() {
@Override
public Observable<JsonDocument> call(String id) {
return bucket.async().get(id);
}
})
.toList()
.toBlocking()
.single();
I want to return Map
instead of List
.My return type would be Map<String, JsonDocument>
.
I tried with toMap
method but it did not work for me.