code: public static <G, K, V> Map<G, List<Map.Entry<K, V>>> groupEntriesBy(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<G> closure) {
          final Map<G, List<Map.Entry<K, V>>> answer = new LinkedHashMap<G, List<Map.Entry<K, V>>>();
          for (Map.Entry<K, V> entry : self.entrySet()) {
              G value = callClosureForMapEntry(closure, entry);
              groupAnswer(answer, entry, value);
          }
          return answer;
      }
docs: Groups all map entries into groups determined by the
  supplied mapping closure. The closure will be passed a Map.Entry or
  key and value (depending on the number of parameters the closure accepts)
  and should return the key that each item should be grouped under.  The
  resulting map will have an entry for each 'group' key returned by the
  closure, with values being the list of map entries that belong to each
  group. (If instead of a list of map entries, you want an actual map
  use {code}groupBy{code}.)
  <pre class="groovyTestCase">def result = [a:1,b:2,c:3,d:4,e:5,f:6].groupEntriesBy { it.value % 2 }
  assert result[0]*.key == ["b", "d", "f"]
  assert result[1]*.value == [1, 3, 5]</pre>
  
  @param self    a map to group
  @param closure a 1 or 2 arg Closure mapping entries on keys
  @return a new Map grouped by keys
  @since 1.5.2