title: Builder with lambda expression for Java 8
body: <p>I have two class with me as mentioned below.
  I wanted to create two instances of <strong><code>class A</code></strong>.</p>
  
  <p>I want to create instance obj2 from existing instance obj1 with updated value of a3 attribute as <strong><code>"Java"</code></strong>.</p>
  
  <p>I had tried below line using <strong>Builder</strong>, but it's not working.</p>
  
  <pre><code>A obj2 = obj1.builder().a3("Java").build();
  </code></pre>
  
  <p>I am able to do it with calling constructor, but I wanted to do it <strong><code>Builder</code></strong> pattern only.</p>
  
  <pre><code>@Builder(toBuilder = true)
  @Data
  class A {
      String a1;
      String a2;
      String a3;
      B b;
  
      A(String b1, String b2, String b3, B b) {
          this.a1 = b1;
          this.a2 = b2;
          this.a3 = b3;
          this.b = b;
      }
  }
  
  @Builder
  @Data
  class B {
      String b1;
      String b2;
      String b3;
  
      B(String b1, String b2, String b3) {
          this.b1 = b1;
          this.b2 = b2;
          this.b3 = b3;
      }
  
  }
  
  class Main {
      public static void main(String[] args) {
  
          B b = new B("a", "b", "b");
          A obj1 = new A("a1", "b1", "b1", b);
          A obj2 = new A("x1", "y1", "z1", b);
          List&lt;A&gt; list= new ArrayList&lt;&gt;();
          list.add(obj1);
          list.add(obj2);
          list.forEach(a -&gt; {
              a.toBuilder().a1("newA1").a2("newA2").build();
              repository.save(a);
          });
  
          A obj3 = obj1.toBuilder().a3("Java").build();
      }
  }
  </code></pre>
  
  <p>As mentioned in updated code , i have list of A with me, and i want to update <strong><code>a1 and a2</code></strong> attributes of all element in list using builder. But builder is not working fine with lambda.
  If i will use setter with below code it's working fine.</p>
  
  <pre><code>list.forEach(a -&gt; {
      a.setA1("newA1");
      a.setA2("newA2");
  });
  </code></pre>
  
  <p>I am not able to get updated values for <strong><code>a1 and a2</code></strong> in case of <strong><code>Builder</code></strong> with <strong><code>Lambda</code></strong></p>