package d.j0;

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

/* JADX INFO: compiled from: MapWithDefault.kt */
/* JADX INFO: loaded from: classes.dex */
@d.n
class j0 {
    public static final <K, V> V a(Map<K, ? extends V> map, K k) {
        d.n0.c.s.e(map, "<this>");
        if (map instanceof h0) {
            return (V) ((h0) map).a(k);
        }
        V v = map.get(k);
        if (v != null || map.containsKey(k)) {
            return v;
        }
        throw new NoSuchElementException("Key " + k + " is missing in the map.");
    }
}
