title: RxJava: Split Rx Flowable into multiple streams
body: <p>I would like to perform some operations on stream, and then split stream into two streams, and then process them separately.</p>
  
  <p>Example to show problem:</p>
  
  <pre><code>Flowable&lt;SuccessfulObject&gt; stream = Flowable.fromArray(
          new SuccessfulObject(true, 0),
          new SuccessfulObject(false, 1),
          new SuccessfulObject(true, 2));
  
  stream = stream.doOnEach(System.out::println);
  
  Flowable&lt;SuccessfulObject&gt; successful = stream.filter(SuccessfulObject::isSuccess);
  Flowable&lt;SuccessfulObject&gt; failed = stream.filter(SuccessfulObject::isFail);
  
  successful.doOnEach(successfulObject -&gt; {/*handle success*/}).subscribe();
  failed.doOnEach(successfulObject -&gt; {/*handle fail*/}).subscribe();
  </code></pre>
  
  <p>Class:</p>
  
  <pre><code>class SuccessfulObject {
      private boolean success;
      private int id;
  
      public SuccessfulObject(boolean success, int id) {
          this.success = success;
          this.id = id;
      }
  
      public boolean isSuccess() {
          return success;
      }
      public boolean isFail() {
          return !success;
      }
  
      public void setSuccess(boolean success) {
          this.success = success;
      }
  
      @Override
      public String toString() {
          return "SuccessfulObject{" +
                  "id=" + id +
                  '}';
      }
  }
  </code></pre>
  
  <p>But this code prints all elements twice whereas I would like to perform all operations before splitting only once.<br><br>
  Output:</p>
  
  <blockquote>
    <p>OnNextNotification[SuccessfulObject{id=0}]<br>
    OnNextNotification[SuccessfulObject{id=1}]<br>
    OnNextNotification[SuccessfulObject{id=2}] <br>OnCompleteNotification<br>
    OnNextNotification[SuccessfulObject{id=0}]<br>
    OnNextNotification[SuccessfulObject{id=1}]<br>
    OnNextNotification[SuccessfulObject{id=2}] <br>OnCompleteNotification<br></p>
  </blockquote>
  
  <p>How can I process the stream to receive this behaviour?</p>