code: public static <K, V> boolean retainAll(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure condition) {
          Iterator<Map.Entry<K, V>> iter = self.entrySet().iterator();
          BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
          boolean result = false;
          while (iter.hasNext()) {
              Map.Entry<K, V> entry = iter.next();
              if (!bcw.callForMap(entry)) {
                  iter.remove();
                  result = true;
              }
          }
          return result;
      }
docs: Modifies this map so that it retains only its elements that are matched
  according to the specified closure condition.  In other words, removes from
  this map all of its elements that don't match. If the closure takes one
  parameter then it will be passed the <code>Map.Entry</code>. Otherwise the closure should
  take two parameters, which will be the key and the value.
  
  <pre class="groovyTestCase">def map = [a:1, b:2]
  map.retainAll { k,v {@code ->} k == 'b' }
  assert map == [b:2]</pre>
  
  See also <code>findAll</code> when wanting to produce a new map containing items
  which match some criteria but leaving the original map unchanged.
  
  @param self a Map to be modified
  @param condition a 1 or 2 arg Closure condition applying on the entries
  @return <tt>true</tt> if this map changed as a result of the call
  @since 2.5.0