title: Changing an object property from an object list - every object is getting the property changed
body: <p>i have a list of objects: </p>
  
  <pre><code>List&lt;TaskDataValue&gt; configuredTaskData = sourceofdata;
  </code></pre>
  
  <p>I am iterating the list, to change a property from an object WITHIN the object:</p>
  
  <pre><code>for (int i=0; i&lt;configuredTaskData.size(); i++) {
      FieldConfiguration fc = configuredTaskData.get(i).getSettings();
      String fieldName = configuredTaskData.get(i).getName();
      if (newLabels.containsKey(fieldName)) {
         fc.setLabel(newLabels.get(fieldName));
         configuredTaskData.get(i).setSettings(fc);
      }
  }
  </code></pre>
  
  <p>although what is happening is that every TaskDataValue.getSettings.label is set to the last one,</p>
  
  <p>sounds like <code>configuredTaskData.get(i).setSettings(fc);</code> is setting not only to <code>i</code> but to evry one</p>
  
  <p>What can be happening here ?</p>
  
  <p>using java 1.6</p>