package n;

import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import x4.AbstractC3250p;

/* JADX INFO: renamed from: n.e, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C2578e extends d0 implements Map {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public androidx.datastore.preferences.protobuf.f0 f21417d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public C2575b f21418e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public C2577d f21419f;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C2578e(d0 d0Var) {
        super(0);
        int i6 = d0Var.f21416c;
        b(this.f21416c + i6);
        if (this.f21416c != 0) {
            for (int i7 = 0; i7 < i6; i7++) {
                put(d0Var.g(i7), d0Var.j(i7));
            }
        } else if (i6 > 0) {
            AbstractC3250p.x(0, 0, i6, d0Var.f21414a, this.f21414a);
            AbstractC3250p.B(d0Var.f21415b, 0, this.f21415b, 0, i6 << 1);
            this.f21416c = i6;
        }
    }

    @Override // java.util.Map
    public final Set entrySet() {
        androidx.datastore.preferences.protobuf.f0 f0Var = this.f21417d;
        if (f0Var != null) {
            return f0Var;
        }
        androidx.datastore.preferences.protobuf.f0 f0Var2 = new androidx.datastore.preferences.protobuf.f0(2, this);
        this.f21417d = f0Var2;
        return f0Var2;
    }

    public final boolean k(Collection collection) {
        Iterator it = collection.iterator();
        while (it.hasNext()) {
            if (!super.containsKey(it.next())) {
                return false;
            }
        }
        return true;
    }

    @Override // java.util.Map
    public final Set keySet() {
        C2575b c2575b = this.f21418e;
        if (c2575b != null) {
            return c2575b;
        }
        C2575b c2575b2 = new C2575b(this);
        this.f21418e = c2575b2;
        return c2575b2;
    }

    public final boolean l(Collection collection) {
        int i6 = this.f21416c;
        Iterator it = collection.iterator();
        while (it.hasNext()) {
            super.remove(it.next());
        }
        return i6 != this.f21416c;
    }

    public final boolean m(Collection collection) {
        int i6 = this.f21416c;
        for (int i7 = i6 - 1; i7 >= 0; i7--) {
            if (!collection.contains(g(i7))) {
                h(i7);
            }
        }
        return i6 != this.f21416c;
    }

    @Override // java.util.Map
    public final void putAll(Map map) {
        b(map.size() + this.f21416c);
        for (Map.Entry entry : map.entrySet()) {
            put(entry.getKey(), entry.getValue());
        }
    }

    @Override // java.util.Map
    public final Collection values() {
        C2577d c2577d = this.f21419f;
        if (c2577d != null) {
            return c2577d;
        }
        C2577d c2577d2 = new C2577d(this);
        this.f21419f = c2577d2;
        return c2577d2;
    }
}
