title: RXJava Observable Operator from list to list of HashMap
body: <p>I have an array of Observable. I need to output a List of HashMap. But I am only getting one element of the array in the output.</p>
  
  <p>If input is <code>[1,2,3,4]</code></p>
  
  <p>Output should be <code>{"results":[1,2,3,4]}</code></p>
  
  <p>I have the below:</p>
  
  <pre><code>result.flatMap(asyncN1qlQueryResult -&gt;
    asyncN1qlQueryResult.errors().flatMap(error -&gt; {
      return Observable
        .error(new Exception("unable to execute n1ql query " + error.toString()));
    })
    .switchIfEmpty(asyncN1qlQueryResult.rows())
  ).map(row -&gt; {
      JsonObject json = ((AsyncN1qlQueryRow) row).value();
      return json;
    }).map(json -&gt; {
      sbResults.append(json.toString());
      sbResults.append(",");log.info(" sbresults : " + sbResults.toString());
      return sbResults;
    })
    .map(results -&gt; {
      resultMap.put("results", results.toString());
      return resultMap;
    });
  </code></pre>
  
  <p>THis does not seem to work because I am only getting a single element in the output.</p>