code: public static <K, V> Map<K, V> each(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure closure) {
          for (Map.Entry entry : self.entrySet()) {
              callClosureForMapEntry(closure, entry);
          }
          return self;
      }
docs: Allows a Map to be iterated through using a closure. If the
  closure takes one parameter then it will be passed the Map.Entry
  otherwise if the closure takes two parameters then it will be
  passed the key and the value.
  <pre class="groovyTestCase">def result = ""
  [a:1, b:3].each { key, value {@code ->} result += "$key$value" }
  assert result == "a1b3"</pre>
  <pre class="groovyTestCase">def result = ""
  [a:1, b:3].each { entry {@code ->} result += entry }
  assert result == "a=1b=3"</pre>
  
  In general, the order in which the map contents are processed
  cannot be guaranteed. In practise, specialized forms of Map,
  e.g. a TreeMap will have its contents processed according to
  the natural ordering of the map.
  
  @param self    the map over which we iterate
  @param closure the 1 or 2 arg closure applied on each entry of the map
  @return returns the self parameter
  @since 1.5.0