package X6FRs_4.QxJ9d_1.KQgRr5e_0.QxJ9d_1;

import java.util.Iterator;
import java.util.Map;
import java.util.WeakHashMap;
/* compiled from: SafeIterableMap.java */
/* loaded from: classes.dex */
public class QxJ9d_1<K, V> implements Iterable<Map.Entry<K, V>> {

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public PGPF6hQ_2<K, V> f1098KQgRr5e_0;
    public PGPF6hQ_2<K, V> QxJ9d_1;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public WeakHashMap<IFxWkV_5<K, V>, Boolean> f1099KQgRr5e_0 = new WeakHashMap<>();
    public int KQgRr5e_0 = 0;

    /* compiled from: SafeIterableMap.java */
    /* loaded from: classes.dex */
    public interface IFxWkV_5<K, V> {
        void KQgRr5e_0(PGPF6hQ_2<K, V> pGPF6hQ_2);
    }

    /* compiled from: SafeIterableMap.java */
    /* loaded from: classes.dex */
    public static class KQgRr5e_0<K, V> extends X6FRs_4<K, V> {
        public KQgRr5e_0(PGPF6hQ_2<K, V> pGPF6hQ_2, PGPF6hQ_2<K, V> pGPF6hQ_22) {
            super(pGPF6hQ_2, pGPF6hQ_22);
        }

        @Override // X6FRs_4.QxJ9d_1.KQgRr5e_0.QxJ9d_1.QxJ9d_1.X6FRs_4, X6FRs_4.QxJ9d_1.KQgRr5e_0.QxJ9d_1.QxJ9d_1.IFxWkV_5
        public PGPF6hQ_2<K, V> KQgRr5e_0(PGPF6hQ_2<K, V> pGPF6hQ_2) {
            return pGPF6hQ_2.QxJ9d_1;
        }

        @Override // X6FRs_4.QxJ9d_1.KQgRr5e_0.QxJ9d_1.QxJ9d_1.X6FRs_4
        public PGPF6hQ_2<K, V> QxJ9d_1(PGPF6hQ_2<K, V> pGPF6hQ_2) {
            return pGPF6hQ_2.KQgRr5e_0;
        }
    }

    /* compiled from: SafeIterableMap.java */
    /* loaded from: classes.dex */
    public static class PGPF6hQ_2<K, V> implements Map.Entry<K, V> {
        public PGPF6hQ_2<K, V> KQgRr5e_0;

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public final K f1101KQgRr5e_0;
        public PGPF6hQ_2<K, V> QxJ9d_1;

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public final V f1102QxJ9d_1;

        public PGPF6hQ_2(K k, V v) {
            this.f1101KQgRr5e_0 = k;
            this.f1102QxJ9d_1 = v;
        }

        @Override // java.util.Map.Entry
        public boolean equals(Object obj) {
            if (obj == this) {
                return true;
            }
            if (obj instanceof PGPF6hQ_2) {
                PGPF6hQ_2 pGPF6hQ_2 = (PGPF6hQ_2) obj;
                return this.f1101KQgRr5e_0.equals(pGPF6hQ_2.f1101KQgRr5e_0) && this.f1102QxJ9d_1.equals(pGPF6hQ_2.f1102QxJ9d_1);
            }
            return false;
        }

        @Override // java.util.Map.Entry
        public K getKey() {
            return this.f1101KQgRr5e_0;
        }

        @Override // java.util.Map.Entry
        public V getValue() {
            return this.f1102QxJ9d_1;
        }

        @Override // java.util.Map.Entry
        public int hashCode() {
            return this.f1101KQgRr5e_0.hashCode() ^ this.f1102QxJ9d_1.hashCode();
        }

        @Override // java.util.Map.Entry
        public V setValue(V v) {
            throw new UnsupportedOperationException("An entry modification is not supported");
        }

        public String toString() {
            return this.f1101KQgRr5e_0 + "=" + this.f1102QxJ9d_1;
        }
    }

    /* compiled from: SafeIterableMap.java */
    /* renamed from: X6FRs_4.QxJ9d_1.KQgRr5e_0.QxJ9d_1.QxJ9d_1$QxJ9d_1  reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public static class C0065QxJ9d_1<K, V> extends X6FRs_4<K, V> {
        public C0065QxJ9d_1(PGPF6hQ_2<K, V> pGPF6hQ_2, PGPF6hQ_2<K, V> pGPF6hQ_22) {
            super(pGPF6hQ_2, pGPF6hQ_22);
        }

        @Override // X6FRs_4.QxJ9d_1.KQgRr5e_0.QxJ9d_1.QxJ9d_1.X6FRs_4, X6FRs_4.QxJ9d_1.KQgRr5e_0.QxJ9d_1.QxJ9d_1.IFxWkV_5
        public PGPF6hQ_2<K, V> KQgRr5e_0(PGPF6hQ_2<K, V> pGPF6hQ_2) {
            return pGPF6hQ_2.KQgRr5e_0;
        }

        @Override // X6FRs_4.QxJ9d_1.KQgRr5e_0.QxJ9d_1.QxJ9d_1.X6FRs_4
        public PGPF6hQ_2<K, V> QxJ9d_1(PGPF6hQ_2<K, V> pGPF6hQ_2) {
            return pGPF6hQ_2.QxJ9d_1;
        }
    }

    public PGPF6hQ_2<K, V> KQgRr5e_0(K k) {
        PGPF6hQ_2<K, V> pGPF6hQ_2 = this.f1098KQgRr5e_0;
        while (pGPF6hQ_2 != null && !pGPF6hQ_2.f1101KQgRr5e_0.equals(k)) {
            pGPF6hQ_2 = pGPF6hQ_2.KQgRr5e_0;
        }
        return pGPF6hQ_2;
    }

    public Map.Entry<K, V> QxJ9d_1() {
        return this.QxJ9d_1;
    }

    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof QxJ9d_1) {
            QxJ9d_1 qxJ9d_1 = (QxJ9d_1) obj;
            if (size() != qxJ9d_1.size()) {
                return false;
            }
            Iterator<Map.Entry<K, V>> it = iterator();
            Iterator<Map.Entry<K, V>> it2 = qxJ9d_1.iterator();
            while (it.hasNext() && it2.hasNext()) {
                Map.Entry<K, V> next = it.next();
                Map.Entry<K, V> next2 = it2.next();
                if ((next == null && next2 != null) || (next != null && !next.equals(next2))) {
                    return false;
                }
            }
            return (it.hasNext() || it2.hasNext()) ? false : true;
        }
        return false;
    }

    public int hashCode() {
        Iterator<Map.Entry<K, V>> it = iterator();
        int i = 0;
        while (it.hasNext()) {
            i += it.next().hashCode();
        }
        return i;
    }

    @Override // java.lang.Iterable
    public Iterator<Map.Entry<K, V>> iterator() {
        KQgRr5e_0 kQgRr5e_0 = new KQgRr5e_0(this.f1098KQgRr5e_0, this.QxJ9d_1);
        this.f1099KQgRr5e_0.put(kQgRr5e_0, false);
        return kQgRr5e_0;
    }

    public int size() {
        return this.KQgRr5e_0;
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        Iterator<Map.Entry<K, V>> it = iterator();
        while (it.hasNext()) {
            sb.append(it.next().toString());
            if (it.hasNext()) {
                sb.append(", ");
            }
        }
        sb.append("]");
        return sb.toString();
    }

    /* compiled from: SafeIterableMap.java */
    /* loaded from: classes.dex */
    public class Mqv2r_3 implements Iterator<Map.Entry<K, V>>, IFxWkV_5<K, V> {
        public PGPF6hQ_2<K, V> KQgRr5e_0;
        public boolean QxJ9d_1 = true;

        public Mqv2r_3() {
        }

        @Override // X6FRs_4.QxJ9d_1.KQgRr5e_0.QxJ9d_1.QxJ9d_1.IFxWkV_5
        public void KQgRr5e_0(PGPF6hQ_2<K, V> pGPF6hQ_2) {
            PGPF6hQ_2<K, V> pGPF6hQ_22 = this.KQgRr5e_0;
            if (pGPF6hQ_2 == pGPF6hQ_22) {
                PGPF6hQ_2<K, V> pGPF6hQ_23 = pGPF6hQ_22.QxJ9d_1;
                this.KQgRr5e_0 = pGPF6hQ_23;
                this.QxJ9d_1 = pGPF6hQ_23 == null;
            }
        }

        @Override // java.util.Iterator
        public boolean hasNext() {
            if (this.QxJ9d_1) {
                return QxJ9d_1.this.f1098KQgRr5e_0 != null;
            }
            PGPF6hQ_2<K, V> pGPF6hQ_2 = this.KQgRr5e_0;
            return (pGPF6hQ_2 == null || pGPF6hQ_2.KQgRr5e_0 == null) ? false : true;
        }

        @Override // java.util.Iterator
        /* renamed from: KQgRr5e_0 */
        public Map.Entry<K, V> next() {
            if (this.QxJ9d_1) {
                this.QxJ9d_1 = false;
                this.KQgRr5e_0 = QxJ9d_1.this.f1098KQgRr5e_0;
            } else {
                PGPF6hQ_2<K, V> pGPF6hQ_2 = this.KQgRr5e_0;
                this.KQgRr5e_0 = pGPF6hQ_2 != null ? pGPF6hQ_2.KQgRr5e_0 : null;
            }
            return this.KQgRr5e_0;
        }
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public V m529KQgRr5e_0(K k, V v) {
        PGPF6hQ_2<K, V> KQgRr5e_02 = KQgRr5e_0((QxJ9d_1<K, V>) k);
        if (KQgRr5e_02 != null) {
            return KQgRr5e_02.f1102QxJ9d_1;
        }
        KQgRr5e_0((QxJ9d_1<K, V>) k, (K) v);
        return null;
    }

    /* compiled from: SafeIterableMap.java */
    /* loaded from: classes.dex */
    public static abstract class X6FRs_4<K, V> implements Iterator<Map.Entry<K, V>>, IFxWkV_5<K, V> {
        public PGPF6hQ_2<K, V> KQgRr5e_0;
        public PGPF6hQ_2<K, V> QxJ9d_1;

        public X6FRs_4(PGPF6hQ_2<K, V> pGPF6hQ_2, PGPF6hQ_2<K, V> pGPF6hQ_22) {
            this.KQgRr5e_0 = pGPF6hQ_22;
            this.QxJ9d_1 = pGPF6hQ_2;
        }

        public abstract PGPF6hQ_2<K, V> KQgRr5e_0(PGPF6hQ_2<K, V> pGPF6hQ_2);

        @Override // X6FRs_4.QxJ9d_1.KQgRr5e_0.QxJ9d_1.QxJ9d_1.IFxWkV_5
        public void KQgRr5e_0(PGPF6hQ_2<K, V> pGPF6hQ_2) {
            if (this.KQgRr5e_0 == pGPF6hQ_2 && pGPF6hQ_2 == this.QxJ9d_1) {
                this.QxJ9d_1 = null;
                this.KQgRr5e_0 = null;
            }
            PGPF6hQ_2<K, V> pGPF6hQ_22 = this.KQgRr5e_0;
            if (pGPF6hQ_22 == pGPF6hQ_2) {
                this.KQgRr5e_0 = KQgRr5e_0((PGPF6hQ_2) pGPF6hQ_22);
            }
            if (this.QxJ9d_1 == pGPF6hQ_2) {
                this.QxJ9d_1 = KQgRr5e_0();
            }
        }

        public abstract PGPF6hQ_2<K, V> QxJ9d_1(PGPF6hQ_2<K, V> pGPF6hQ_2);

        @Override // java.util.Iterator
        public boolean hasNext() {
            return this.QxJ9d_1 != null;
        }

        public final PGPF6hQ_2<K, V> KQgRr5e_0() {
            PGPF6hQ_2<K, V> pGPF6hQ_2 = this.QxJ9d_1;
            PGPF6hQ_2<K, V> pGPF6hQ_22 = this.KQgRr5e_0;
            if (pGPF6hQ_2 == pGPF6hQ_22 || pGPF6hQ_22 == null) {
                return null;
            }
            return QxJ9d_1(pGPF6hQ_2);
        }

        @Override // java.util.Iterator
        /* renamed from: KQgRr5e_0  reason: collision with other method in class */
        public Map.Entry<K, V> next() {
            PGPF6hQ_2<K, V> pGPF6hQ_2 = this.QxJ9d_1;
            this.QxJ9d_1 = KQgRr5e_0();
            return pGPF6hQ_2;
        }
    }

    public PGPF6hQ_2<K, V> KQgRr5e_0(K k, V v) {
        PGPF6hQ_2<K, V> pGPF6hQ_2 = new PGPF6hQ_2<>(k, v);
        this.KQgRr5e_0++;
        PGPF6hQ_2<K, V> pGPF6hQ_22 = this.QxJ9d_1;
        if (pGPF6hQ_22 == null) {
            this.f1098KQgRr5e_0 = pGPF6hQ_2;
            this.QxJ9d_1 = pGPF6hQ_2;
            return pGPF6hQ_2;
        }
        pGPF6hQ_22.KQgRr5e_0 = pGPF6hQ_2;
        pGPF6hQ_2.QxJ9d_1 = pGPF6hQ_22;
        this.QxJ9d_1 = pGPF6hQ_2;
        return pGPF6hQ_2;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public V m528KQgRr5e_0(K k) {
        PGPF6hQ_2<K, V> KQgRr5e_02 = KQgRr5e_0((QxJ9d_1<K, V>) k);
        if (KQgRr5e_02 == null) {
            return null;
        }
        this.KQgRr5e_0--;
        if (!this.f1099KQgRr5e_0.isEmpty()) {
            for (IFxWkV_5<K, V> iFxWkV_5 : this.f1099KQgRr5e_0.keySet()) {
                iFxWkV_5.KQgRr5e_0(KQgRr5e_02);
            }
        }
        PGPF6hQ_2<K, V> pGPF6hQ_2 = KQgRr5e_02.QxJ9d_1;
        if (pGPF6hQ_2 != null) {
            pGPF6hQ_2.KQgRr5e_0 = KQgRr5e_02.KQgRr5e_0;
        } else {
            this.f1098KQgRr5e_0 = KQgRr5e_02.KQgRr5e_0;
        }
        PGPF6hQ_2<K, V> pGPF6hQ_22 = KQgRr5e_02.KQgRr5e_0;
        if (pGPF6hQ_22 != null) {
            pGPF6hQ_22.QxJ9d_1 = KQgRr5e_02.QxJ9d_1;
        } else {
            this.QxJ9d_1 = KQgRr5e_02.QxJ9d_1;
        }
        KQgRr5e_02.KQgRr5e_0 = null;
        KQgRr5e_02.QxJ9d_1 = null;
        return KQgRr5e_02.f1102QxJ9d_1;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public Iterator<Map.Entry<K, V>> m530KQgRr5e_0() {
        C0065QxJ9d_1 c0065QxJ9d_1 = new C0065QxJ9d_1(this.QxJ9d_1, this.f1098KQgRr5e_0);
        this.f1099KQgRr5e_0.put(c0065QxJ9d_1, false);
        return c0065QxJ9d_1;
    }

    public QxJ9d_1<K, V>.Mqv2r_3 KQgRr5e_0() {
        QxJ9d_1<K, V>.Mqv2r_3 mqv2r_3 = new Mqv2r_3();
        this.f1099KQgRr5e_0.put(mqv2r_3, false);
        return mqv2r_3;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public Map.Entry<K, V> m531KQgRr5e_0() {
        return this.f1098KQgRr5e_0;
    }
}
