package defpackage;

import java.util.Iterator;
import java.util.Map;
import java.util.WeakHashMap;

/* JADX INFO: renamed from: ʿʞᵬˊ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C0358 implements Iterable {

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public C5017 f2157;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public C5017 f2159;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public final WeakHashMap f2158 = new WeakHashMap();

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public int f2160 = 0;

    /* JADX WARN: Code restructure failed: missing block: B:24:0x0048, code lost:
    
        if (r1.hasNext() != false) goto L28;
     */
    /* JADX WARN: Code restructure failed: missing block: B:26:0x0050, code lost:
    
        if (((defpackage.C4958) r6).hasNext() != false) goto L28;
     */
    /* JADX WARN: Code restructure failed: missing block: B:27:0x0052, code lost:
    
        return true;
     */
    /* JADX WARN: Code restructure failed: missing block: B:28:0x0053, code lost:
    
        return false;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof C0358)) {
            return false;
        }
        C0358 c0358 = (C0358) obj;
        if (this.f2160 != c0358.f2160) {
            return false;
        }
        Iterator it = iterator();
        Iterator it2 = c0358.iterator();
        while (true) {
            C4958 c4958 = (C4958) it;
            if (!c4958.hasNext()) {
                break;
            }
            C4958 c49582 = (C4958) it2;
            if (!c49582.hasNext()) {
                break;
            }
            Map.Entry entry = (Map.Entry) c4958.next();
            Object next = c49582.next();
            if ((entry == null && next != null) || (entry != null && !entry.equals(next))) {
                break;
            }
        }
        return false;
    }

    public final int hashCode() {
        Iterator it = iterator();
        int iHashCode = 0;
        while (true) {
            C4958 c4958 = (C4958) it;
            if (!c4958.hasNext()) {
                return iHashCode;
            }
            iHashCode += ((Map.Entry) c4958.next()).hashCode();
        }
    }

    @Override // java.lang.Iterable
    public final Iterator iterator() {
        C5017 c5017 = this.f2157;
        C5017 c50172 = this.f2159;
        C4958 c4958 = new C4958();
        c4958.f18827 = c50172;
        c4958.f18828 = c5017;
        this.f2158.put(c4958, Boolean.FALSE);
        return c4958;
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder("[");
        Iterator it = iterator();
        while (true) {
            C4958 c4958 = (C4958) it;
            if (!c4958.hasNext()) {
                sb.append("]");
                return sb.toString();
            }
            sb.append(((Map.Entry) c4958.next()).toString());
            if (c4958.hasNext()) {
                sb.append(", ");
            }
        }
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final Object m1677(Object obj, Object obj2) {
        C5017 c5017 = this.f2157;
        while (c5017 != null && !c5017.f19014.equals(obj)) {
            c5017 = c5017.f19015;
        }
        if (c5017 != null) {
            return c5017.f19016;
        }
        C5017 c50172 = new C5017(obj, obj2);
        this.f2160++;
        C5017 c50173 = this.f2159;
        if (c50173 == null) {
            this.f2157 = c50172;
            this.f2159 = c50172;
            return null;
        }
        c50173.f19015 = c50172;
        c50172.f19017 = c50173;
        this.f2159 = c50172;
        return null;
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final Object m1678(Object obj) {
        C5017 c5017 = this.f2157;
        while (c5017 != null && !c5017.f19014.equals(obj)) {
            c5017 = c5017.f19015;
        }
        if (c5017 == null) {
            return null;
        }
        this.f2160--;
        WeakHashMap weakHashMap = this.f2158;
        if (!weakHashMap.isEmpty()) {
            Iterator it = weakHashMap.keySet().iterator();
            while (it.hasNext()) {
                ((AbstractC1423) it.next()).mo4093(c5017);
            }
        }
        C5017 c50172 = c5017.f19017;
        C5017 c50173 = c5017.f19015;
        if (c50172 != null) {
            c50172.f19015 = c50173;
        } else {
            this.f2157 = c50173;
        }
        C5017 c50174 = c5017.f19015;
        if (c50174 != null) {
            c50174.f19017 = c50172;
        } else {
            this.f2159 = c50172;
        }
        c5017.f19015 = null;
        c5017.f19017 = null;
        return c5017.f19016;
    }
}
