title: update Map key's value java
body: <p>Ok I have this code:</p>
  
  <pre><code>TreeMap&lt;DateTime, Integer&gt; tree2 = getDatesTreeMap();
  DateTime startx = new DateTime(startDate.getTime());
  DateTime endx = new DateTime(endDate.getTime());
  boolean possible = false;
  int testValue = 0;
  //produces submap
  Map&lt;DateTime, Integer&gt; nav = tree2.subMap(startx, endx);
  
  for (Integer capacity : tree2.subMap(startx, endx).values()) {
      //Provides an insight into capacity accomodation possibility
      //testValue++;
      terminals = 20;
      if(capacity &gt;= terminals)
          possible = true;
      else if(capacity &lt; terminals)
          possible = false;
  
  }
  
  if(possible == true)
  {
      for (Integer capacity : tree2.subMap(startx, endx).values()) {
      {
          capacity -= terminals;
          //not sure what to do
      }
  }
  }else{
  
  }
  
  return possible;
  </code></pre>
  
  <p>It checks for range of date in submap. then checks if values of those dates (which are keys btw) can accomodate terminals (that is reservation number), then if yes it would subtract that from capacity currently in map. I am unsure how to update the capacity in the map for all dates between startx and endx with value </p>
  
  <pre><code>capacity -= terminals;
  </code></pre>
  
  <p>Thanks,
  :)</p>