guava/src/com/google/common/collect/MultimapBuilder.java
public static <K0> MultimapBuilderWithKeys<K0> treeKeys(final Comparator<K0> comparator) {
    checkNotNull(comparator);
    return new MultimapBuilderWithKeys<K0>() {
      @Override
      <K extends K0, V> Map<K, Collection<V>> createMap() {
        return new TreeMap<>(comparator);
      }
    };
  }
public static <K0> MultimapBuilderWithKeys<K0> treeKeys(final Comparator<K0> comparator) {
    checkNotNull(comparator);
    return new MultimapBuilderWithKeys<K0>() {
      @Override
      <K extends K0, V> Map<K, Collection<V>> createMap() {
        return new TreeMap<>(comparator);
      }
    };
  }
public static < K0 > MultimapBuilderWithKeys < K0 > treeKeys ( final Comparator < K0 > comparator ) { checkNotNull ( comparator ) ; return new MultimapBuilderWithKeys < K0 > ( ) { @ Override < K extends K0 , V > Map < K , Collection < V > > createMap ( ) { return new TreeMap <> ( comparator ) ; } } ; }
Uses a {@link TreeMap} sorted by the specified comparator to map keys to value collections.

<p>The collections returned by {@link Multimap#keySet()}, {@link Multimap#keys()}, and {@link
Multimap#asMap()} will iterate through the keys in sorted order.

<p>For all multimaps generated by the resulting builder, the {@link Multimap#keySet()} can be
safely cast to a {@link java.util.SortedSet}, and the {@link Multimap#asMap()} can safely be
cast to a {@link java.util.SortedMap}.

<p>Multimaps generated by the resulting builder will not be serializable if {@code comparator}
is not serializable.
Uses a { @link TreeMap } sorted by the specified comparator to map keys to value collections .