title: Remove all entries from HashMap where value is NOT what I'm looking for
body: <p>The title question summarizes it nicely, but assume I am coding in Java and have a <code>HashMap</code> that looks something like this (it has a lot more entries obviously):</p>
  
  <pre><code>Map&lt;String, Integer&gt; myMap = new HashMap&lt;&gt;();
  
  myMap.put{"a", 1}
  myMap.put{"b", 2}
  myMap.put{"c", 2}
  myMap.put{"d", 3}
  </code></pre>
  
  <p>Now I don't like entries with the value of 2, so I want to remove them <strong><em>all</em></strong> as effectively as possible, leaving me only with the entries that have value 1 or 3.</p>
  
  <p>It should look as if my map was instead made like this:</p>
  
  <pre><code>Map&lt;String, Integer&gt; myMap = new HashMap&lt;&gt;();
  
  myMap.put{"a", 1}
  myMap.put{"d", 3}
  </code></pre>
  
  <p>As if my 2-valued entries were never there at all!</p>
  
  <p>What are my options for doing this in an effective way?</p>