package defpackage;

import androidx.media3.container.NalUnitUtil;
import java.util.Iterator;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010(\n\u0000\b\n\u0018\u00002\b\u0012\u0004\u0012\u00028\u00000\u0001¨\u0006\u0002"}, d2 = {"Ldg2;", "", "kotlin-stdlib"}, k = 1, mv = {2, 1, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class dg2 implements Iterator<Object>, f25 {
    public final Iterator a;
    public int b;

    public dg2(eg2 eg2Var) {
        this.a = eg2Var.a.getA();
        this.b = eg2Var.b;
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        Iterator it;
        while (true) {
            int i = this.b;
            it = this.a;
            if (i <= 0 || !it.hasNext()) {
                break;
            }
            it.next();
            this.b--;
        }
        return it.hasNext();
    }

    @Override // java.util.Iterator
    public final Object next() {
        Iterator it;
        while (true) {
            int i = this.b;
            it = this.a;
            if (i <= 0 || !it.hasNext()) {
                break;
            }
            it.next();
            this.b--;
        }
        return it.next();
    }

    @Override // java.util.Iterator
    public final void remove() {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }
}
