package j.k0;

import java.util.Map;
import java.util.NoSuchElementException;

/* JADX INFO: compiled from: MapWithDefault.kt */
/* JADX INFO: loaded from: classes.dex */
class i0 {
    public static final <K, V> V a(Map<K, ? extends V> map, K k2) {
        j.p0.d.r.f(map, "<this>");
        if (map instanceof g0) {
            return (V) ((g0) map).a(k2);
        }
        V v = map.get(k2);
        if (v != null || map.containsKey(k2)) {
            return v;
        }
        throw new NoSuchElementException("Key " + k2 + " is missing in the map.");
    }
}
