title: Adding repetead String keys to map using foreach where value is the number of repetitions
body: <p>In my process to learn Java 8 forEach, I'm trying to change this code:</p>
  
  <pre><code>   Integer counter; 
     for(String s : stringList) {
          counter = myMap.get(s); 
  
          if(counter == null) {
              myMap.put(s, 1);
          }
          else {
              myMap.put(s, counter + 1);
          }
      }
  </code></pre>
  
  <p>As you can see, the idea is that if the String is absent, it's added as key and the value is set to 1.
  When the key is present, counter is equal to the latest value and then the value is replace with counter + 1.</p>
  
  <p>I tried this:</p>
  
  <pre><code>stringList.forEach(s-&gt; myMap.putIfAbsent(s,1));
  </code></pre>
  
  <p>but that just covers half the job.</p>
  
  <p>I know that methods like computeIfAbsent and computeIfPresent exist, but after the key, a function is required but I'm not sure what. Can't change the value to counter since it should be final. Seems like there isn't putIfPresent...</p>
  
  <p>Is it possible to do this using forEach and a lambda expression or should I just keep it like that?</p>