title: Java-Collections, cannot overwrite old value with new value
body: <p>I got a question regarding Java-Collections. I iterate through a Java-Collection and if an if-clause is true, I want to change the entry of the Collection. Within the if-clause body the new Value is accepted, but if I want to print the whole collection later, it prints out again the Collection with the old value.</p>
  
  <p>Here the Code:</p>
  
  <pre><code>public boolean checkConsumeStorageCapacity(Multimap&lt;String, Values&gt; mm1,   Multimap&lt;String, Values&gt; mm2)
  {
      boolean enoughStorageCapacity = false;
  
       Multimap&lt;String, Values&gt; mmApp = mm1;
  
       Multimap&lt;String, Values&gt; mmHW = mm2;
  
       Collection&lt;Values&gt; colA = mmApp.get("Storage");
       Collection&lt;Values&gt; colH = mmHW.get("Memory");
  for (Values vA2 : colA) {
      for (Values vH2 : colH) {
  
          if (vA2.getName().equals("Size") &amp;&amp; vH2.getName().equals("Size")) {
  
              float StoSize = Float.parseFloat(vA2.getValue());
              float MemSize = Float.parseFloat(vH2.getValue());
              float maintainableStoSize = StoSize * maintainabilityfactor;
  
              if (MemSize &gt;= maintainableStoSize) {
  
                  MemSize -= maintainableStoSize;
                  vH2.setValue(String.valueOf(MemSize));
  
                  String s = vH2.getValue();
                  System.out.println(s);
  
                  enoughStorageCapacity = true;
                  return enoughStorageCapacity;
  
              }
              break;
          }
  
      }
  }
  
  System.out.println(colH);
  </code></pre>
  
  <p>Values is a object containing 3 String. The getters/setters are all declared correctly. Printing out s gives the correct value, but printing out colH gives again the old value. Isnt setting the new Value enough, do I additionally have to commit anything in the Collection?</p>
  
  <p>Thanks a lot in advance.</p>
  
  <p>edit:
  here the values class, for further understanding.</p>
  
  <pre><code>public class Values {
  
  private String name;
   private String type;
   private String value;
  
  public Values(String name, String type, String value)
   {
      this.name = name; 
      this.type = type; 
      this.value = value;
  }
  public String getName()
   {
      return name;
   }
  public String getType()
   {
      return type;
   }
  public String getValue()
   {
      return value;
   }
  public void setName(String name)
  {
      this.name = name; 
  }
  public void setValue(String value)
  {
      this.value = value; 
  }
  public void setType(String type)
  {
      this.type = type; 
  }
  
  @Override
  public String toString() {
      return "name=" + name + ", type=" + type + ", value=" + value;
      }
  
  }
  </code></pre>