guava/src/com/google/common/collect/ImmutableMap.java
public static <T, K, V> Collector<T, ?, ImmutableMap<K, V>> toImmutableMap(
      Function<? super T, ? extends K> keyFunction,
      Function<? super T, ? extends V> valueFunction) {
    return CollectCollectors.toImmutableMap(keyFunction, valueFunction);
  }
public static <T, K, V> Collector<T, ?, ImmutableMap<K, V>> toImmutableMap(
      Function<? super T, ? extends K> keyFunction,
      Function<? super T, ? extends V> valueFunction) {
    return CollectCollectors.toImmutableMap(keyFunction, valueFunction);
  }
Returns a {@link Collector} that accumulates elements into an {@code ImmutableMap} whose keys
and values are the result of applying the provided mapping functions to the input elements.
Entries appear in the result {@code ImmutableMap} in encounter order.

<p>If the mapped keys contain duplicates (according to {@link Object#equals(Object)}, an {@code
IllegalArgumentException} is thrown when the collection operation is performed. (This differs
from the {@code Collector} returned by {@link Collectors#toMap(Function, Function)}, which
throws an {@code IllegalStateException}.)

@since 21.0