code: protected static <T> T callClosureForMapEntry(Closure<T> closure, Map.Entry entry) {
          if (closure.getMaximumNumberOfParameters() == 2) {
              return closure.call(new Object[]{entry.getKey(), entry.getValue()});
          }
          return closure.call(entry);
      }
docs: internal helper method