How to merge items from flatMapIterable
<p>I have an infinite observable (db observer) that emits finite sequences of items, that need to be processed and then emitted back as a group. </p>

<p>The problem here is, how to write it so that <code>toList</code> doesn't wait for the original source to finish, but for the flatMapIterable generated sequence instead;</p>

<pre><code>DbObservable.map(new Func1&lt;Query, List&lt;Item&gt;&gt;() {
                        @Override
                        public List&lt;Item&gt; call(Query query) {
                            return query.items; //get items from db query
                        }
                    })
                    .flatMapIterable(new Func1&lt;List&lt;Item&gt;, Iterable&lt;Item&gt;&gt;() {
                        @Override
                        public Iterable&lt;Item&gt; call(List&lt;GeoStop&gt; geoStops) {
                            return geoStops;
                        }
                    })
                    .flatMap(/*process*/)
                    .toList() // regenerate List that was passed in to flatMapIterable
                    //subscribe and emit list of items
</code></pre>

<p>Nothing reaches subscribers due to <code>toList</code> being stuck waiting for <code>DbObservable</code>'s <code>onComplete</code>. </p>