code: public static <K, V, T, U extends T, W extends T> T inject(Map<K, V> self, U initialValue, @ClosureParams(value=FromString.class,options={"U,Map.Entry<K,V>","U,K,V"})  Closure<W> closure) {
          T value = initialValue;
          for (Map.Entry<K, V> entry : self.entrySet()) {
              if (closure.getMaximumNumberOfParameters() == 3) {
                  value = closure.call(value, entry.getKey(), entry.getValue());
              } else {
                  value = closure.call(value, entry);
              }
          }
          return value;
      }
docs: Iterates through the given Map, passing in the initial value to
  the 2-arg Closure along with the first item (or 3-arg Closure along with the first key and value).
  The result is passed back (injected) into
  the closure along with the second item. The new result is injected back into
  the closure along with the third item and so on until the entire collection
  has been used. Also known as <tt>foldLeft</tt> or <tt>reduce</tt> in functional parlance.
  
  Examples:
  <pre class="groovyTestCase">
  def map = [a:1, b:2, c:3]
  assert map.inject([]) { list, k, v {@code ->}
  list + [k] * v
  } == ['a', 'b', 'b', 'c', 'c', 'c']
  </pre>
  
  @param self         a Map
  @param initialValue some initial value
  @param closure      a 2 or 3 arg Closure
  @return the result of the last closure call
  @since 1.8.1