title: Combine multiple mono in Spring Webflux
body: <p>I'm new with webflux and I'm trying to execute multiple monos with <code>Flux</code>. But i think i'm doing it wrong.. is this the best approach to execute multiple <code>Mono</code> and collect it to list?</p>
  
  <p>Here is my code:</p>
  
  <pre class="lang-java prettyprint-override"><code>    mainService.getAllBranch()
              .flatMapMany(branchesList -&gt; {
                  List&lt;Branch&gt; branchesList2 = (List&lt;Branch&gt;) branchesList.getData();
                  List&lt;Mono&lt;Transaction&gt;&gt; trxMonoList= new ArrayList&lt;&gt;();
  
                  branchesList2.stream().forEach(branch -&gt; {
                      trxMonoList.add(mainService.getAllTrxByBranchId(branch.branchId));
                  });
                  return Flux.concat(trxMonoList); // &lt;--- is there any other way than using concat?
              })
              .collectList()
              .flatMap(resultList -&gt; combineAllList());
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>    interface MainService{
              Mono&lt;RespBody&gt; getAllBranch();
              Mono&lt;RespBody&gt; getAllTrxByBranchId(String branchId); //will return executed url ex: http://trx.com/{branchId}
      }
  </code></pre>
  
  <p>so far my with above code i can explain it like this:</p>
  
  <ol>
  <li>Get all branches</li>
  <li>iterate through all <code>branchesList2</code> and add it to <code>trxMonoList</code> </li>
  <li>return <code>Flux.concat</code>, this is where i'm not sure is this the right way or not. but it's working</li>
  <li>combine all list</li>
  </ol>
  
  <p>I'm just confuse is this the proper way to use <code>Flux</code> in my context? or is there any better way to achieve with what i'm trying to do?</p>