title: RX Java all elements in a flowable reach certain condition
body: <p>I am trying to perform a <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/usingHLmpuJava.html" rel="nofollow noreferrer">MultiPart upload</a> to S3 in an asynchronous way with RxJava 2.</p>
  
  <pre><code>compile "io.reactivex.rxjava2:rxjava:2.2.2"
  </code></pre>
  
  <p>I have a <code>Flowable</code> of parts. For each part I call a method on a <code>TransferManager</code> object which returns immediately an <code>Upload</code> object.</p>
  
  <p><code>Upload::isDone</code> method javadoc looks like:</p>
  
  <p><code>
  /**
       * Returns whether or not the transfer is finished (i.e. completed successfully,
       * failed, or was canceled).
       *
       * @return Returns &lt;code&gt;true&lt;/code&gt; if this transfer is finished (i.e. completed successfully,
       *         failed, or was canceled).  Returns &lt;code&gt;false&lt;/code&gt; if otherwise.
       */
      public boolean isDone();
  </code></p>
  
  <p>This is what I am trying to do: </p>
  
  <p><code>TransferManager</code>:</p>
  
  <pre><code>public class TransferManager {
  
      public Upload transfer(Part part) {
          return new Upload();
      }
  }
  </code></pre>
  
  <p><code>Part</code>:</p>
  
  <pre><code>public class Part {}
  </code></pre>
  
  <p><code>Upload</code>:</p>
  
  <pre><code>import java.util.Random;
  
  public class Upload {
      public boolean isDone() {
          return new Random().nextInt(10) == 1;
      }
  }
  </code></pre>
  
  <p>This is what I am doing:</p>
  
  <pre><code>  TransferManager tm = new TransferManager();
          Flowable.just(new Part(), new Part(), new Part(), new Part(), new Part())
                  .map(part -&gt; tm.transfer(part))
                  .subscribe(upload -&gt; {
                      do {
                      } while(!upload.isDone());
                  });
  </code></pre>
  
  <p>What will be the proper RxJava way to do this?</p>