title: Updating an entry of a HashMap whose values is a List
body: <p>I have a <code>HashMap&lt;Integer, List&lt;Integer&gt;&gt;</code> "<code>sq_diff</code>" and I am trying to update an entry.</p>
  
  <p>I tried:</p>
  
  <pre><code>List&lt;Integer&gt; values = sq_diff.get(diff);
  values.add(c);
  values.add(d);
  sq_diff.put(diff, values);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>sq_diff.get(diff).add(c);
  sq_diff.get(diff).add(d);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>sq_diff.computeIfPresent(diff, (k, v) -&gt; v.add(c);
  sq_diff.computeIfPresent(diff, (k, v) -&gt; v.add(d);
  </code></pre>
  
  <p>None of them working: </p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.UnsupportedOperationException</p>
  </blockquote>
  
  <p><strong>The map contains an entry of</strong> "<code>diff</code>"</p>
  
  <p><strong>Highly appreciated if you can indicate problems on each of them.</strong></p>