title: Java 8 - Streams Nested ForEach with different Collection
body: <p>I try to understand the new Java 8 Streams and I tried for days to transfer nested foreach loops over collection in Java 8 Streams.</p>
  
  <p>Is it possible to refactor the following nested foreach loops including the if-conditions in Java-8-Streams? </p>
  
  <p>If yes what would it look like.</p>
  
  <pre><code>ArrayList&lt;ClassInq&gt; Inq = new ArrayList&lt;&gt;();
  TreeMap&lt;String, SalesQuot&gt; Quotations = new TreeMap&lt;&gt;();
  
  ArrayList&lt;ClassInq&gt; tempInqAndQuot = new ArrayList&lt;&gt;();
  ArrayList&lt;SalesQuot&gt; tempQuotPos = new ArrayList&lt;&gt;();   
  
  for(ClassInq simInq : this.Inq) {
      if(!simInq.isClosed() &amp;&amp; !simInq.isDenied()) {
          for(Map.Entry&lt;String, SalesQuot&gt; Quot: Quotations.entrySet()) {
  
              SalesQuot sapQuot = Quot.getValue();
  
              if(sapQuot.getInquiryDocumentNumber().compareTo(simInq.getSapInquiryNumber()) == 0) {
  
                  simInq.setSAPQuotationNumber(sapQuot.getQuotationDocumentNumber());
                  tempInqAndQuot.add(simInq);
  
                  for(Map.Entry&lt;String, SalesQuotPosition&gt; quotp : sapQuot.getPosition().entrySet()) {
                      tempQuotPos.add(quotp.getValue());
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>Thanks a lot for your help.</p>
  
  <p>BR</p>