guava/src/com/google/common/collect/Multimaps.java
public static <K, V> SortedSetMultimap<K, V> newSortedSetMultimap(
      Map<K, Collection<V>> map, final Supplier<? extends SortedSet<V>> factory) {
    return new CustomSortedSetMultimap<>(map, factory);
  }
public static <K, V> SortedSetMultimap<K, V> newSortedSetMultimap(
      Map<K, Collection<V>> map, final Supplier<? extends SortedSet<V>> factory) {
    return new CustomSortedSetMultimap<>(map, factory);
  }
Creates a new {@code SortedSetMultimap} that uses the provided map and factory. It can generate
a multimap based on arbitrary {@link Map} and {@link SortedSet} classes.

<p>The {@code factory}-generated and {@code map} classes determine the multimap iteration
order. They also specify the behavior of the {@code equals}, {@code hashCode}, and {@code
toString} methods for the multimap and its returned views. However, the multimap's {@code get}
method returns instances of a different class than {@code factory.get()} does.

<p>The multimap is serializable if {@code map}, {@code factory}, the sets generated by {@code
factory}, and the multimap contents are all serializable.

<p>The multimap is not threadsafe when any concurrent operations update the multimap, even if
{@code map} and the instances generated by {@code factory} are. Concurrent read operations will
work correctly. To allow concurrent update operations, wrap the multimap with a call to {@link
#synchronizedSortedSetMultimap}.

<p>Call this method only when the simpler methods {@link TreeMultimap#create()} and {@link
TreeMultimap#create(Comparator, Comparator)} won't suffice.

<p>Note: the multimap assumes complete ownership over of {@code map} and the sets returned by
{@code factory}. Those objects should not be manually updated and they should not use soft,
weak, or phantom references.

@param map place to store the mapping from each key to its corresponding values
@param factory supplier of new, empty sorted sets that will each hold all values for a given
key
@throws IllegalArgumentException if {@code map} is not empty