title: How to replace HashMap Values while iterating over them in Java
body: <p>I am using a Runnable to automatically subtract 20 from a players cooldown every second, but I have no idea how to replace the value of a value as I iterate through it. How can I have it update the value of each key?</p>
  
  <pre><code>public class CoolDownTimer implements Runnable {
      @Override
      public void run() {
          for (Long l : playerCooldowns.values()) {
              l = l - 20;
              playerCooldowns.put(Key???, l);
          }
      }
  
  }
  </code></pre>