android/guava/src/com/google/common/collect/Maps.java
public static <K, V> ImmutableMap<K, V> toMap(
      Iterable<K> keys, Function<? super K, V> valueFunction) {
    return toMap(keys.iterator(), valueFunction);
  }
public static <K, V> ImmutableMap<K, V> toMap(
      Iterable<K> keys, Function<? super K, V> valueFunction) {
    return toMap(keys.iterator(), valueFunction);
  }
Returns an immutable map whose keys are the distinct elements of {@code keys} and whose value
for each key was computed by {@code valueFunction}. The map's iteration order is the order of
the first appearance of each key in {@code keys}.

<p>When there are multiple instances of a key in {@code keys}, it is unspecified whether {@code
valueFunction} will be applied to more than one instance of that key and, if it is, which
result will be mapped to that key in the returned map.

<p>If {@code keys} is a {@link Set}, a live view can be obtained instead of a copy using {@link
Maps#asMap(Set, Function)}.

@throws NullPointerException if any element of {@code keys} is {@code null}, or if {@code
valueFunction} produces {@code null} for any key
@since 14.0