package k;

import java.util.Iterator;

/* JADX INFO: renamed from: k.b, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C2366b extends AbstractC2369e implements Iterator {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public C2367c f19603a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public C2367c f19604b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ int f19605c;

    public C2366b(C2367c c2367c, C2367c c2367c2, int i6) {
        this.f19605c = i6;
        this.f19603a = c2367c2;
        this.f19604b = c2367c;
    }

    @Override // k.AbstractC2369e
    public final void a(C2367c c2367c) {
        C2367c c2367c2;
        C2367c c2367cB = null;
        if (this.f19603a == c2367c && c2367c == this.f19604b) {
            this.f19604b = null;
            this.f19603a = null;
        }
        C2367c c2367c3 = this.f19603a;
        if (c2367c3 == c2367c) {
            switch (this.f19605c) {
                case 0:
                    c2367c2 = c2367c3.f19609d;
                    break;
                default:
                    c2367c2 = c2367c3.f19608c;
                    break;
            }
            this.f19603a = c2367c2;
        }
        C2367c c2367c4 = this.f19604b;
        if (c2367c4 == c2367c) {
            C2367c c2367c5 = this.f19603a;
            if (c2367c4 != c2367c5 && c2367c5 != null) {
                c2367cB = b(c2367c4);
            }
            this.f19604b = c2367cB;
        }
    }

    public final C2367c b(C2367c c2367c) {
        switch (this.f19605c) {
            case 0:
                return c2367c.f19608c;
            default:
                return c2367c.f19609d;
        }
    }

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

    @Override // java.util.Iterator
    public final Object next() {
        C2367c c2367c = this.f19604b;
        C2367c c2367c2 = this.f19603a;
        this.f19604b = (c2367c == c2367c2 || c2367c2 == null) ? null : b(c2367c);
        return c2367c;
    }
}
