guava/src/com/google/common/collect/Multimaps.java
@CanIgnoreReturnValue
  public static <K, V, M extends Multimap<K, V>> M invertFrom(
      Multimap<? extends V, ? extends K> source, M dest) {
    checkNotNull(dest);
    for (Map.Entry<? extends V, ? extends K> entry : source.entries()) {
      dest.put(entry.getValue(), entry.getKey());
    }
    return dest;
  }
@CanIgnoreReturnValue
  public static <K, V, M extends Multimap<K, V>> M invertFrom(
      Multimap<? extends V, ? extends K> source, M dest) {
    checkNotNull(dest);
    for (Map.Entry<? extends V, ? extends K> entry : source.entries()) {
      dest.put(entry.getValue(), entry.getKey());
    }
    return dest;
  }
@ CanIgnoreReturnValue public static < K , V , M extends Multimap < K , V > > M invertFrom ( Multimap < ? extends V , ? extends K > source , M dest ) { checkNotNull ( dest ) ; for ( Map . Entry < ? extends V , ? extends K > entry : source . entries ( ) ) { dest . put ( entry . getValue ( ) , entry . getKey ( ) ) ; } return dest ; }
Copies each key-value mapping in {@code source} into {@code dest}, with its key and value
reversed.

<p>If {@code source} is an {@link ImmutableMultimap}, consider using {@link
ImmutableMultimap#inverse} instead.

@param source any multimap
@param dest the multimap to copy into; usually empty
@return {@code dest}
Copies each key - value mapping in { @code source } into { @code dest } with its key and value reversed .