title: How to use stream to apply multiple filters and convert to a List
body: <p><br/>
  
  here is my problem, 
  I have a  List&lt;A> lista1, what I should do is :</p>
  
  <ol>
  <li><p>map&lt;key, List&lt;A>> m = groupby(lista1);</p>
  
  <pre class="lang-java prettyprint-override"><code>m = lista.stream.collect(Collectors.groupingBy);
  </code></pre></li>
  <li><p>for every group, return one element with some condition, and make a new list List&lt;A> lista2 = MakeListfromGroup(m)<br/></p>
  
  <pre class="lang-java prettyprint-override"><code>List&lt;A&gt; lista2;
  for (Map.Entry&lt;key, List&lt;A&gt;&gt; entry : m.entrySet()) {
      A theOne;
      for (A a : entry.getValue()) {
          if(condition){
              theOne = a;
          }
      }
      lista2.add(theOne);
  }
  return lista2;
  </code></pre></li>
  <li><p>List&lt;B> listb1 = makeListB(lista2); //here, I cant use stream.map.collect<br/></p>
  
  <pre class="lang-java prettyprint-override"><code>List&lt;Integer&gt; b1Key;
  List&lt;Integer&gt; b2Key;
  for(A a : lista2){
      b1key.add(a.b1key);
      b2key.add(a.b2key);
  }
  mapb1 = gerfromBD(b1key);
  mapb2 = gerfromBD(b2key);
  List&lt;B&gt; listb1;
  for(A a : lista2){
      listb1.add(new B(mapb1.get(a.b1key),mapb2.get(a.b2key));
  }
   return listb1
  </code></pre></li>
  <li><p>B has member B1 b1 and B2 b2, create a new List&lt;B> listb2= applyFilter(list&lt;predicate&lt;B1>>,list&lt;predicate&lt;B2>>)</p>
  
  <pre class="lang-java prettyprint-override"><code>List&lt;B&gt; listb2;
  nextb:
  for(B b : listb1){
      for(Predicate p: filtreB1){
          if(!p.accept(b.b1)){
              continue nextb;
          }
      }
      for(Predicate p: filtreB2){
          if(!p.accept(b.b2)){
              continue nextb;
          }
      }
      listb2.add(b);
  }
  return listb2;
  </code></pre></li>
  </ol>
  
  <p>Is it possible to put all in one stream? or do the step 4 in a stream way?</p>
  
  <p>thanks in advance</p>