title: How to set value inside nested forEach() in java8?
body: <p>I have a case in which I am iterating the <code>List&lt;DiscountClass&gt;</code> and need to compare the list value with another <code>List&lt;TypeCode&gt;</code>, based on satisfying the condition (when <code>Discount.code</code> equals <code>TypeCode.code</code>) I need to set <code>Discount.setCodeDescr()</code>. How to achieve this with nested forEach loop in java 8? (I am not able to set after comparing the values in java 8 forEach).</p>
  
  <pre><code>for (Discount dis : discountList) {
      for (TypeCode code : typeCodeList) {
          if (dis.getCode().equals(code.getCode())) {
              dis.setCodeDesc(code.getCodeDesc());
          }
      }
  }
  </code></pre>