title: How to get Map with condition using RxJava2 and RxAndroid?
body: <p>So, I have sorted by condition list of objects</p>
  
  <pre><code>private Observable&lt;CallServiceCode&gt; getUnansweredQuestionList() {
      return Observable.fromIterable(getServiceCodeArrayList())
                 .subscribeOn(Schedulers.computation())
                 .filter(iServiceCode -&gt; iServiceCode.getServiceCodeFormStatus().isUnanswered());
  }
  </code></pre>
  
  <p>and now what I need to do:</p>
  
  <p>Every object has list <code>servicePartList</code> , I need to filter this list by condition and eventually if final size of this filtered list <code>&gt;0</code>, so I need to add object that contains this list <code>CallServiceCode object</code> as a key and this filtered list as a value.</p>
  
  <p>So it should be like this:</p>
  
  <pre><code>private Map&lt;CallServiceCode, ArrayList&lt;CallServicePart&gt;&gt; getSortedMap() {
        Map&lt;CallServiceCode, ArrayList&lt;CallServicePart&gt;&gt; result = new HashMap&lt;&gt;();
  
        getUnansweredQuestionList()
            .filter(callServiceCode -&gt; Observable.fromIterable(callServiceCode.getCallServicePartList()) //
            .filter(servicePart -&gt; servicePart.getServicePartFormStatus().isUnanswered())//
            .isNotEmpty())
            .subscribe(callServiceCode -&gt; result.put(callServiceCode, Observable.fromIterable(callServiceCode.getCallServicePartList()) //
                                                                                                  .filter(servicePart -&gt; servicePart.getServicePartFormStatus().isUnanswered()));
        return result;
  }
  </code></pre>
  
  <p>But there is no such method <code>isNotEmpty()</code> in RxJava2 and also it is not right to add key like this:</p>
  
  <pre><code>Observable.fromIterable(callServiceCode.getCallServicePartList())
      .filter(servicePart -&gt; servicePart.getServicePartFormStatus().isUnanswered())
  </code></pre>
  
  <p>So question is how to make it properly?</p>