title: Collecting Observables to a List doesn't seem to emit the collection at once
body: <p>I'm using RxJava to essentially collect the list of individually emitted Observables and combine them into a list of Observables (essentially sort of the opposite of flatMap). Here's my code:</p>
  
  <pre><code>        // myEvent.findMemberships() returns an Observable&lt;List&lt;Membership&gt;&gt;
  
          myEvent.findMemberships()
               .flatMap(new Func1&lt;List&lt;Membership&gt;, Observable&lt;User&gt;&gt;() {
                 @Override
                 public Observable&lt;User&gt; call(List&lt;Membership&gt; memberships) {
                   List&lt;User&gt; users = new ArrayList&lt;User&gt;();
                   for (Membership membership : memberships) {
                     users.add(membership.getUser());
                   }
                   return Observable.from(users);
                 }
               })
               .toList()
               .subscribeOn(Schedulers.newThread())
               .observeOn(AndroidSchedulers.mainThread())
               .subscribe(new Observer&lt;List&lt;User&gt;&gt;() {
                 @Override
                 public void onCompleted() { }
  
                 @Override
                 public void onError(Throwable e) {
                   Timber.e(e, "Error when trying to get memberships");
                 }
  
                 @Override
                 public void onNext(List&lt;User&gt; users) {
                   Timber.d("%d users emitted", users.size());
                 }
               })
  </code></pre>
  
  <p>I notice that my onNext is never called. I can't seem to understand this. If i remove the .toList call and basically output the individual Users (as shown below) it works by emitting each item. </p>
  
  <pre><code>subscriptions //
      .add(currentEvent.findMemberships()
               .flatMap(new Func1&lt;List&lt;Membership&gt;, Observable&lt;User&gt;&gt;() {
                 @Override
                 public Observable&lt;User&gt; call(List&lt;Membership&gt; memberships) {
                   List&lt;User&gt; users = new ArrayList&lt;User&gt;();
                   for (Membership membership : memberships) {
                     users.add(membership.getUser());
                   }
                   return Observable.from(users);
                 }
               })
               .subscribeOn(Schedulers.newThread())
               .observeOn(AndroidSchedulers.mainThread())
               .subscribe(new Observer&lt;User&gt;() {
                 @Override
                 public void onCompleted() { }
  
                 @Override
                 public void onError(Throwable e) {
                   Timber.e(e, "Error when trying to get memberships");
                 }
  
                 @Override
                 public void onNext(User user) {
                   Timber.d("%d users emitted", user.getName());
                 }
               }));
  </code></pre>
  
  <p>Q1. Is my understanding of .toList incorrect?</p>
  
  <p>Q2. How does one combing a stream of individually emitted <code>Observable&lt;Object&gt;</code>s into a single <code>Observable&lt;List&lt;Object&gt;&gt;</code> ?</p>
  
  <p>** EDIT </p>
  
  <p>@kjones totally nailed the issue. I was not calling onComplete with my findMemberships call. I've added the code snippet below. My real use case was a little more convoluted with a bunch of more transformations which is why I needed to be using .toList call. As @zsxwing also rightly pointed out, for just this use case, a simple map will suffice.</p>
  
  <pre><code>public Observable&lt;List&lt;Membership&gt;&gt; findMemberships() {
  return Observable.create(new Observable.OnSubscribe&lt;List&lt;Membership&gt;&gt;() {
    @Override
    public void call(Subscriber&lt;? super List&lt;Membership&gt;&gt; subscriber) {
      try {
        // .....
        List&lt;Membership&gt; memberships = queryMyDb();
  
        subscriber.onNext(memberships);
  
        // BELOW STATEMENT FIXES THE PROBLEM &gt;&lt;
        // subscriber.onCompleted();
  
      } catch (SQLException e) {
        // ...
      }
    }
  });
  </code></pre>
  
  <p>}</p>