Пример #1
0
 /** Stringifies a Map in a stable fashion. */
 public static <K extends Comparable<K>, V> void toStringSorted(
     Map<K, V> map, StringBuilder builder) {
   builder.append('{');
   List<Entry<K, V>> sortedProperties = Maps.sortedEntries(map);
   int index = 0;
   for (Entry<K, V> entry : sortedProperties) {
     if (index > 0) {
       builder.append(", ");
     }
     builder.append(entry.getKey()).append('=').append(entry.getValue());
     index++;
   }
   builder.append('}');
 }