package defpackage;

import defpackage.fa5;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.NoSuchElementException;

/* JADX INFO: loaded from: classes2.dex */
class ga5 implements Iterator<Object> {
    public fa5.c a;
    public fa5.a b;
    public int c;
    public final /* synthetic */ fa5.b d;

    public ga5(fa5.b bVar) {
        this.d = bVar;
        this.a = bVar.e;
        this.c = bVar.d;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        fa5.b bVar = this.d;
        if (bVar.d == this.c) {
            return this.a != bVar;
        }
        throw new ConcurrentModificationException();
    }

    @Override // java.util.Iterator
    public final Object next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        fa5.a aVar = (fa5.a) this.a;
        Object obj = aVar.b;
        this.b = aVar;
        this.a = aVar.b();
        return obj;
    }

    @Override // java.util.Iterator
    public final void remove() {
        fa5.b bVar = this.d;
        if (bVar.d != this.c) {
            throw new ConcurrentModificationException();
        }
        if7.p(this.b != null, "no calls to next() since the last call to remove()");
        bVar.remove(this.b.b);
        this.c = bVar.d;
        this.b = null;
    }
}
