package p;

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

/* JADX INFO: renamed from: p.f, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C1409f implements Iterable {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public C1406c f16018q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public C1406c f16019r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final WeakHashMap f16020s = new WeakHashMap();

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public int f16021t = 0;

    public C1406c a(Object obj) {
        C1406c c1406c = this.f16018q;
        while (c1406c != null && !c1406c.f16011q.equals(obj)) {
            c1406c = c1406c.f16013s;
        }
        return c1406c;
    }

    public Object b(Object obj) {
        C1406c c1406cA = a(obj);
        if (c1406cA == null) {
            return null;
        }
        this.f16021t--;
        WeakHashMap weakHashMap = this.f16020s;
        if (!weakHashMap.isEmpty()) {
            Iterator it = weakHashMap.keySet().iterator();
            while (it.hasNext()) {
                ((AbstractC1408e) it.next()).a(c1406cA);
            }
        }
        C1406c c1406c = c1406cA.f16014t;
        if (c1406c != null) {
            c1406c.f16013s = c1406cA.f16013s;
        } else {
            this.f16018q = c1406cA.f16013s;
        }
        C1406c c1406c2 = c1406cA.f16013s;
        if (c1406c2 != null) {
            c1406c2.f16014t = c1406c;
        } else {
            this.f16019r = c1406c;
        }
        c1406cA.f16013s = null;
        c1406cA.f16014t = null;
        return c1406cA.f16012r;
    }

    /* JADX WARN: Code restructure failed: missing block: B:24:0x0048, code lost:
    
        if (r3.hasNext() != false) goto L28;
     */
    /* JADX WARN: Code restructure failed: missing block: B:26:0x0050, code lost:
    
        if (((p.C1405b) r7).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 C1409f)) {
            return false;
        }
        C1409f c1409f = (C1409f) obj;
        if (this.f16021t != c1409f.f16021t) {
            return false;
        }
        Iterator it = iterator();
        Iterator it2 = c1409f.iterator();
        while (true) {
            C1405b c1405b = (C1405b) it;
            if (!c1405b.hasNext()) {
                break;
            }
            C1405b c1405b2 = (C1405b) it2;
            if (!c1405b2.hasNext()) {
                break;
            }
            Map.Entry entry = (Map.Entry) c1405b.next();
            Object next = c1405b2.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) {
            C1405b c1405b = (C1405b) it;
            if (!c1405b.hasNext()) {
                return iHashCode;
            }
            iHashCode += ((Map.Entry) c1405b.next()).hashCode();
        }
    }

    @Override // java.lang.Iterable
    public final Iterator iterator() {
        C1405b c1405b = new C1405b(this.f16018q, this.f16019r, 0);
        this.f16020s.put(c1405b, Boolean.FALSE);
        return c1405b;
    }

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