How to get some data from list and create another list with that data in RxJava
<p>I have I case where I got one Object from API. This Object containts ArrayList. This ArrayList containts objects with data I need as another list.</p>

<p>I have this code and it works just fine</p>

<pre><code>Observable&lt;SomePresentationModel&gt; observable = apiService.getData()
    .map(data -&gt; {
      List&lt;Foo&gt; foo = new ArrayList&lt;&gt;();
      for (Bar bar : data.getBars()) {
        foo.addAll(bar.getSomething());
      }
      return asPresentationModel(foo);
    });
</code></pre>

<p>But it looks terrible and I'm sure there is some way to do it better but I don't know how, any ideas?</p>