package com.google.common.collect;

import java.util.AbstractMap;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

/* JADX INFO: loaded from: classes2.dex */
public final class d extends d1 {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ int f23652b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ AbstractMap f23653c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public d(AbstractMap abstractMap, int i10) {
        super(1);
        this.f23652b = i10;
        this.f23653c = abstractMap;
    }

    @Override // com.google.common.collect.d1
    public final Map c() {
        int i10 = this.f23652b;
        AbstractMap abstractMap = this.f23653c;
        switch (i10) {
            case 0:
                return (f) abstractMap;
            default:
                return (s1) abstractMap;
        }
    }

    @Override // com.google.common.collect.d1, java.util.AbstractCollection, java.util.Collection, java.util.Set
    public final boolean contains(Object obj) {
        switch (this.f23652b) {
            case 0:
                Set setEntrySet = ((f) this.f23653c).f23660c.entrySet();
                setEntrySet.getClass();
                try {
                    return setEntrySet.contains(obj);
                } catch (ClassCastException | NullPointerException unused) {
                    return false;
                }
            default:
                return super.contains(obj);
        }
    }

    @Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
    public final Iterator iterator() {
        int i10 = this.f23652b;
        AbstractMap abstractMap = this.f23653c;
        switch (i10) {
            case 0:
                return new e((f) abstractMap);
            default:
                return ((s1) abstractMap).f23723a.iterator();
        }
    }

    @Override // com.google.common.collect.d1, com.google.android.gms.internal.ads.zs1, java.util.AbstractCollection, java.util.Collection, java.util.Set
    public final boolean remove(Object obj) {
        Object objRemove;
        switch (this.f23652b) {
            case 0:
                if (!contains(obj)) {
                    return false;
                }
                Map.Entry entry = (Map.Entry) obj;
                Objects.requireNonNull(entry);
                AbstractMapBasedMultimap abstractMapBasedMultimap = ((f) this.f23653c).f23661d;
                Object key = entry.getKey();
                Map map = abstractMapBasedMultimap.f23568e;
                map.getClass();
                try {
                    objRemove = map.remove(key);
                    break;
                } catch (ClassCastException | NullPointerException unused) {
                    objRemove = null;
                }
                Collection collection = (Collection) objRemove;
                if (collection != null) {
                    int size = collection.size();
                    collection.clear();
                    abstractMapBasedMultimap.f23569f -= size;
                }
                return true;
            default:
                return super.remove(obj);
        }
    }
}
