code: public static <K, V> ImmutableMap<K, V> reduceToMap(Multimap<K, V> multimap,
        Function<? super Collection<V>, ? extends V> reducerFunction) {
      final ImmutableMap.Builder<K, V> ret = ImmutableMap.builder();
  
      for (final Map.Entry<K, Collection<V>> entry : multimap.asMap().entrySet()) {
        // nulls banned by contract
        //noinspection ConstantConditions
        ret.put(entry.getKey(), reducerFunction.apply(entry.getValue()));
      }
  
      return ret.build();
    }
docs: Converts a {@link com.google.common.collect.Multimap} to a {@link java.util.Map} by selecting a
  single value for each key and discarding the others, with the selection procedure being defined
  by {@code reducerFunction}, which may not return {@code null}. Additionally, {@code multimap}
  may not have {@code null} keys.