package defpackage;

import java.util.Iterator;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/* renamed from: ˌˋᵻ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C1591 implements Iterator {

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public C0413 f6327;

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

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public final /* synthetic */ C3161 f6329;

    public C1591(C3161 c3161) {
        this.f6329 = c3161;
        this.f6327 = c3161.f11998;
    }

    public C1591(C3161 c3161, byte b) {
        this.f6329 = c3161;
        this.f6327 = c3161.f11998;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        switch (this.f6328) {
            case 0:
                if (this.f6327 != null) {
                    break;
                }
                break;
            default:
                C0413 c0413 = this.f6327;
                if (c0413 != null) {
                    if (c0413.m1892() == null) {
                        m4569();
                        if (this.f6327 == null) {
                        }
                    }
                    break;
                }
                break;
        }
        return true;
    }

    @Override // java.util.Iterator
    public final Object next() {
        switch (this.f6328) {
            case 0:
                C0413 c0413 = this.f6327;
                if (c0413 == null) {
                    return null;
                }
                Object objM1892 = c0413.m1892();
                this.f6327 = this.f6327.f2310;
                return objM1892;
            default:
                C0413 c04132 = this.f6327;
                if (c04132 == null) {
                    return null;
                }
                Object objM18922 = c04132.m1892();
                if (objM18922 == null) {
                    m4569();
                    return next();
                }
                this.f6327 = this.f6327.f2310;
                return objM18922;
        }
    }

    @Override // java.util.Iterator
    public final void remove() {
        int i = this.f6328;
        C3161 c3161 = this.f6329;
        switch (i) {
            case 0:
                C0413 c0413 = this.f6327;
                if (c0413 != null) {
                    C0413 c04132 = c0413.f2310;
                    c3161.remove(c0413.m1892());
                    this.f6327 = c04132;
                    break;
                }
                break;
            default:
                C0413 c04133 = this.f6327;
                if (c04133 != null) {
                    C0413 c04134 = c04133.f2310;
                    c3161.remove(c04133.m1892());
                    this.f6327 = c04134;
                    break;
                }
                break;
        }
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public void m4569() {
        C0413 c0413;
        C3161 c3161 = this.f6329;
        ReentrantReadWriteLock.WriteLock writeLock = c3161.f11995.writeLock();
        try {
            writeLock.lock();
            do {
                C0413 c04132 = this.f6327;
                c0413 = c04132.f2310;
                this.f6327 = c0413;
                C0413 c04133 = c3161.f11998;
                if (c04132 == c04133) {
                    c3161.f11998 = c04133.f2310;
                }
                C0413 c04134 = c04132.f2311;
                if (c04134 != null) {
                    c04134.f2310 = c0413;
                    C0413 c04135 = c04132.f2310;
                    if (c04135 != null) {
                        c04135.f2311 = c04134;
                    }
                } else if (c0413 != null) {
                    c0413.f2311 = null;
                }
                if (c0413 == null) {
                    break;
                }
            } while (c0413.m1892() == null);
            writeLock.unlock();
        } catch (Throwable th) {
            writeLock.unlock();
            throw th;
        }
    }
}
