code: public static <K, V> Map<K, V> sort(Map<K, V> self, @ClosureParams(value=FromString.class, options={"Map.Entry<K,V>","Map.Entry<K,V>,Map.Entry<K,V>"}) Closure closure) {
          Map<K, V> result = new LinkedHashMap<K, V>();
          List<Map.Entry<K, V>> entries = asList((Iterable<Map.Entry<K, V>>) self.entrySet());
          sort((Iterable<Map.Entry<K, V>>) entries, closure);
          for (Map.Entry<K, V> entry : entries) {
              result.put(entry.getKey(), entry.getValue());
          }
          return result;
      }
docs: Sorts the elements from the given map into a new ordered map using
  the closure as a comparator to determine the ordering.
  The original map is unchanged.
  <pre class="groovyTestCase">def map = [a:5, b:3, c:6, d:4].sort { a, b {@code ->} a.value {@code <=>} b.value }
  assert map == [b:3, d:4, a:5, c:6]</pre>
  
  @param self the original unsorted map
  @param closure a Closure used as a comparator
  @return the sorted map
  @since 1.6.0