title: Filter List or Lists based on the inner lists in RxJava
body: <p>I wanted to filter a list of lists using rxJava and arrived at the following solution. But I am using Observable.toBlocking() at a couple of places. Can I do it more elegantly.</p>
  
  <p>For the sake of the question I have created a list of list where inner is contains range of integers say (1 - 10, 10 - 20) and outer list contains all these lists. And I want filter the list on the basis of terms in the inner list so I pass a collection searchList such that if the inner list contains any of the elements from the searchList I want to keep it.</p>
  
  <p>My Solution:</p>
  
  <pre><code>public static List&lt;List&lt;Integer&gt;&gt; longFuncReturnList(Iterable&lt;List&lt;Integer&gt;&gt; masterIterable, List&lt;Integer&gt; searchList) {
  
      return Observable.from(masterIterable)
      .filter(new Func1&lt;List&lt;Integer&gt;, Boolean&gt;() {
          @Override
          public Boolean call(List&lt;Integer&gt; t1) {
  
  
              Observable&lt;Boolean&gt; result = Observable.from(new IteratorIterable&lt;Integer&gt;(t1.iterator()))
                      .exists(new Func1&lt;Integer, Boolean&gt;() {
                  @Override
                  public Boolean call(Integer t1) {
  
                      return searchList.contains(t1); 
                  }
              });
              return result.toBlocking().first();
          }
      }).toList().toBlocking().single();
  
  }
  </code></pre>
  
  <p>And to this I pass a List of List using the following method:</p>
  
  <pre><code>Iterable&lt;List&lt;Integer&gt;&gt; masterIterable = new IteratorIterable&lt;List&lt;Integer&gt;&gt;(masterList.iterator());
      longFuncReturnList(masterIterable);
  </code></pre>
  
  <p>masterList is my List of List.</p>
  
  <p>For filtering I use Observable.exists() but since it returns another observable I use toBlocking().first() to get the boolean result.</p>
  
  <p>Is my solution correct in a Rx way?
  How can I make it better?</p>