title: Java stream map modifies custom class object not built in classes
body: <pre><code>class Employee {
  
      public String name;
      public Integer age;
      public Employee(String n, int age) {
          this.name = n;
          this.age = age;
      }
      public String toString() {
          return this.name+":"+this.age;
      }
  }
  </code></pre>
  
  <p>Inside Main:</p>
  
  <pre><code>ArrayList&lt;Employee&gt; list = new ArrayList&lt;&gt;();
  list.add(new Employee("NameA", 10));
  list.add(new Employee("NameB", 25));
  list.add(new Employee("NameC", 30));
  list.add(new Employee("NameD", 45));
  list.add(new Employee("NameE", 50));
  
  System.out.println(list);//[NameA:10, NameB:25, NameC:30, NameD:45, NameE:50]
  
  list.stream().filter(e-&gt;e.age%10==0).map(e-&gt;e.name+="CHANGE").collect(Collectors.toList());
  
  System.out.println(list); //[NameACHANGE:10, NameB:25, NameCCHANGE:30, NameD:45, NameECHANGE:50]
  
  
  ArrayList&lt;String&gt; strList = new ArrayList&lt;&gt;();
  strList.add("1");
  strList.add("2");
  strList.add("3");
  strList.add("4");
  strList.add("5");
  
  System.out.println(strList);//[1, 2, 3, 4, 5]
  
  List&lt;String&gt; updatedStrList = strList.stream().map(s-&gt;s+="CHANGE").collect(Collectors.toList());
  
  System.out.println(updatedStrList);//[1CHANGE, 2CHANGE, 3CHANGE, 4CHANGE, 5CHANGE]
  
  System.out.println(strList);//[1, 2, 3, 4, 5]
  </code></pre>
  
  <p>What's the reason for this behaviour?
  When the Employee object's value is being changed the value gets updated in the original ArrayList but when ArrayList of String was changed the values did not reflect in the original ArrayList. </p>