package o; import java.util.Iterator; import java.util.NoSuchElementException; /* loaded from: classes6.dex */ public final class gdJ implements gdA { final gdE b; final int d; /* JADX WARN: Multi-variable type inference failed */ public gdJ(gdE gde, int i) { C14957gcv.e(gde, ""); this.b = gde; this.d = i; if (i >= 0) { return; } StringBuilder sb = new StringBuilder("count must be non-negative, but was "); sb.append(i); sb.append('.'); throw new IllegalArgumentException(sb.toString().toString()); } @Override // o.gdA public final gdE d(int i) { return i >= this.d ? this : new gdJ(this.b, i); } /* loaded from: classes6.dex */ public static final class HBt implements Iterator, InterfaceC14932gcO { private final Iterator a; private int d; HBt(gdJ gdj) { this.d = gdj.d; this.a = gdj.b.e(); } @Override // java.util.Iterator public final T next() { int i = this.d; if (i == 0) { throw new NoSuchElementException(); } this.d = i - 1; return this.a.next(); } @Override // java.util.Iterator public final boolean hasNext() { return this.d > 0 && this.a.hasNext(); } @Override // java.util.Iterator public final void remove() { throw new UnsupportedOperationException("Operation is not supported for read-only collection"); } } @Override // o.gdE public final Iterator e() { return new HBt(this); } }