android/guava/src/com/google/common/collect/Maps.java
public static <K, V> Map<K, V> asMap(Set<K> set, Function<? super K, V> function) {
    return new AsMapView<>(set, function);
  }
public static <K, V> Map<K, V> asMap(Set<K> set, Function<? super K, V> function) {
    return new AsMapView<>(set, function);
  }
Returns a live {@link Map} view whose keys are the contents of {@code set} and whose values are
computed on demand using {@code function}. To get an immutable <i>copy</i> instead, use {@link
#toMap(Iterable, Function)}.

<p>Specifically, for each {@code k} in the backing set, the returned map has an entry mapping
{@code k} to {@code function.apply(k)}. The {@code keySet}, {@code values}, and {@code
entrySet} views of the returned map iterate in the same order as the backing set.

<p>Modifications to the backing set are read through to the returned map. The returned map
supports removal operations if the backing set does. Removal operations write through to the
backing set. The returned map does not support put operations.

<p><b>Warning:</b> If the function rejects {@code null}, caution is required to make sure the
set does not contain {@code null}, because the view cannot stop {@code null} from being added
to the set.

<p><b>Warning:</b> This method assumes that for any instance {@code k} of key type {@code K},
{@code k.equals(k2)} implies that {@code k2} is also of type {@code K}. Using a key type for
which this may not hold, such as {@code ArrayList}, may risk a {@code ClassCastException} when
calling methods on the resulting map view.

@since 14.0