code: public static <K, V, S, T> Map<K, V> collectEntries(Map<S, T> self, Map<K, V> collector, @ClosureParams(MapEntryOrKeyValue.class) Closure<?> transform) {
          for (Map.Entry<S, T> entry : self.entrySet()) {
              addEntry(collector, callClosureForMapEntry(transform, entry));
          }
          return collector;
      }
docs: Iterates through this Map transforming each map entry using the <code>transform</code> closure
  returning a map of the transformed entries.
  <pre class="groovyTestCase">
  assert [a:1, b:2].collectEntries( [:] ) { k, v {@code ->} [v, k] } == [1:'a', 2:'b']
  assert [a:1, b:2].collectEntries( [30:'C'] ) { key, value {@code ->}
  [(value*10): key.toUpperCase()] } == [10:'A', 20:'B', 30:'C']
  </pre>
  Note: When using the list-style of result, the behavior is '<code>def (key, value) = listResultFromClosure</code>'.
  While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case;
  throwing away elements after the second one and using null for the key or value for the case of a shortened list.
  If your collector Map doesn't support null keys or values, you might get a runtime error, e.g. NullPointerException or IllegalArgumentException.
  
  @param self      a Map
  @param collector the Map into which the transformed entries are put
  @param transform the closure used for transforming, which can take one (Map.Entry) or two (key, value) parameters and
  should return a Map.Entry, a Map or a two-element list containing the resulting key and value
  @return the collector with all transformed values added to it
  @see #collect(Map, Collection, Closure)
  @since 1.7.9