title: How to get 2 values from 2 differents RxJava Observables?
body: <p>I have 2 Observables that will return only 1 thing. I need both
     values to do something else.</p>
  
  <p>How can I subscribe to both Observables and receive a notification
     only when both values are available?</p>
  
  <p>I tried something like:</p>
  
  <pre class="lang-java prettyprint-override"><code>   final Observable&lt;String&gt; obs1 = Observable.just("A", "B");
     final Observable&lt;String&gt; obs2 = Observable.just("A", "B");
  
     Observable.zip(
         obs1,
         obs2,
         (a, b) -&gt; {
           System.out.println("Processing " + a + b);
           return null;
         }
     );
  </code></pre>
  
  <p>But nothing happens unless I register a subscriber (which would be
     useless).</p>
  
  <p>The (ugly) solution I used is an embedded subscription such as:</p>
  
  <pre class="lang-java prettyprint-override"><code>   final Observable&lt;String&gt; obs1 = Observable.just("A", "B");
     final Observable&lt;String&gt; obs2 = Observable.just("A", "B");
  
     obs1.subscribe(
       a -&gt; {
         obs2.subscribe(
           b -&gt; {
             System.out.println("Processing " + a + b);
           }
         );
       }
     );
  </code></pre>
  
  <p>What is the way to do such a common thing?</p>