code: public static <K,V> Number count(Map<K,V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<?> closure) {
          long answer = 0;
          BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure);
          for (Object entry : self.entrySet()) {
              if (bcw.callForMap((Map.Entry)entry)) {
                  ++answer;
              }
          }
          // for b/c with Java return an int if we can
          if (answer <= Integer.MAX_VALUE) return (int) answer;
          return answer;
      }
docs: Counts the number of occurrences which satisfy the given closure from inside this map.
  If the closure takes one parameter then it will be passed the Map.Entry.
  Otherwise, the closure should take two parameters and will be passed the key and value.
  <p>
  Example usage:
  <pre class="groovyTestCase">assert [a:1, b:1, c:2, d:2].count{ k,v {@code ->} k == 'a' {@code ||} v == 2 } == 3</pre>
  
  @param self  the map within which we count the number of occurrences
  @param closure a 1 or 2 arg Closure condition applying on the entries
  @return the number of occurrences
  @since 1.8.0