package defpackage;

import java.util.AbstractCollection;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;

/* renamed from: ᵲᵳ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public class C4526 extends AbstractCollection {

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public final Object f16850;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final /* synthetic */ int f16851;

    public /* synthetic */ C4526(int i, Object obj) {
        this.f16851 = i;
        this.f16850 = obj;
    }

    public C4526(AbstractMap abstractMap) {
        this.f16851 = 3;
        this.f16850 = abstractMap;
    }

    @Override // java.util.AbstractCollection, java.util.Collection
    public final void clear() {
        int i = this.f16851;
        Object obj = this.f16850;
        switch (i) {
            case 0:
                ((AbstractC4525) obj).clear();
                break;
            case 1:
                ((C3954) obj).clear();
                break;
            case 2:
                ((C0106) obj).clear();
                break;
            default:
                ((AbstractMap) obj).clear();
                break;
        }
    }

    @Override // java.util.AbstractCollection, java.util.Collection
    public boolean contains(Object obj) {
        int i = this.f16851;
        Object obj2 = this.f16850;
        switch (i) {
            case 0:
                if (!(obj instanceof Map.Entry)) {
                    return false;
                }
                Map.Entry entry = (Map.Entry) obj;
                Object key = entry.getKey();
                Object value = entry.getValue();
                Collection collection = (Collection) ((AbstractC4525) obj2).mo2140().get(key);
                return collection != null && collection.contains(value);
            case 1:
                return ((C3954) obj2).mo5697(obj);
            case 2:
            default:
                return super.contains(obj);
            case 3:
                return ((AbstractMap) obj2).containsValue(obj);
        }
    }

    @Override // java.util.AbstractCollection, java.util.Collection
    public boolean isEmpty() {
        switch (this.f16851) {
            case 3:
                return ((AbstractMap) this.f16850).isEmpty();
            default:
                return super.isEmpty();
        }
    }

    @Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
    public final Iterator iterator() {
        int i = this.f16851;
        Object obj = this.f16850;
        switch (i) {
            case 0:
                return ((AbstractC4525) obj).mo5695();
            case 1:
                return new C0876((C3954) obj, 0);
            case 2:
                C0106 c0106 = (C0106) obj;
                Map mapM1189 = c0106.m1189();
                return mapM1189 != null ? mapM1189.values().iterator() : new C2484(c0106, 2);
            default:
                return new C1220(((AbstractMap) obj).entrySet().iterator());
        }
    }

    @Override // java.util.AbstractCollection, java.util.Collection
    public boolean remove(Object obj) {
        int i = this.f16851;
        Object obj2 = this.f16850;
        switch (i) {
            case 0:
                if (!(obj instanceof Map.Entry)) {
                    return false;
                }
                Map.Entry entry = (Map.Entry) obj;
                return ((AbstractC4525) obj2).remove(entry.getKey(), entry.getValue());
            case 1:
            case 2:
            default:
                return super.remove(obj);
            case 3:
                AbstractMap abstractMap = (AbstractMap) obj2;
                try {
                    return super.remove(obj);
                } catch (UnsupportedOperationException unused) {
                    for (Map.Entry entry2 : abstractMap.entrySet()) {
                        if (ˊˉʤﹳ.ˌᵜᵹᵩ(obj, entry2.getValue())) {
                            abstractMap.remove(entry2.getKey());
                            return true;
                        }
                    }
                    return false;
                }
        }
    }

    @Override // java.util.AbstractCollection, java.util.Collection
    public boolean removeAll(Collection collection) {
        switch (this.f16851) {
            case 3:
                AbstractMap abstractMap = (AbstractMap) this.f16850;
                try {
                    collection.getClass();
                    return super.removeAll(collection);
                } catch (UnsupportedOperationException unused) {
                    HashSet hashSet = new HashSet();
                    for (Map.Entry entry : abstractMap.entrySet()) {
                        if (collection.contains(entry.getValue())) {
                            hashSet.add(entry.getKey());
                        }
                    }
                    return abstractMap.keySet().removeAll(hashSet);
                }
            default:
                return super.removeAll(collection);
        }
    }

    @Override // java.util.AbstractCollection, java.util.Collection
    public boolean retainAll(Collection collection) {
        switch (this.f16851) {
            case 3:
                AbstractMap abstractMap = (AbstractMap) this.f16850;
                try {
                    collection.getClass();
                    return super.retainAll(collection);
                } catch (UnsupportedOperationException unused) {
                    HashSet hashSet = new HashSet();
                    for (Map.Entry entry : abstractMap.entrySet()) {
                        if (collection.contains(entry.getValue())) {
                            hashSet.add(entry.getKey());
                        }
                    }
                    return abstractMap.keySet().retainAll(hashSet);
                }
            default:
                return super.retainAll(collection);
        }
    }

    @Override // java.util.AbstractCollection, java.util.Collection
    public final int size() {
        int i = this.f16851;
        Object obj = this.f16850;
        switch (i) {
            case 0:
                return ((AbstractC4525) obj).size();
            case 1:
                return ((C3954) obj).f14929;
            case 2:
                return ((C0106) obj).size();
            default:
                return ((AbstractMap) obj).size();
        }
    }
}
