package o; import java.util.Iterator; import java.util.NoSuchElementException; /* loaded from: classes6.dex */ public final class gdH implements gdA { final int b; final gdE c; final int d; /* JADX WARN: Multi-variable type inference failed */ public gdH(gdE gde, int i, int i2) { C14957gcv.e(gde, ""); this.c = gde; this.d = i; this.b = i2; if (i < 0) { throw new IllegalArgumentException("startIndex should be non-negative, but is ".concat(String.valueOf(i)).toString()); } if (i2 < 0) { throw new IllegalArgumentException("endIndex should be non-negative, but is ".concat(String.valueOf(i2)).toString()); } if (i2 >= i) { return; } StringBuilder sb = new StringBuilder("endIndex should be not less than startIndex, but was "); sb.append(i2); sb.append(" < "); sb.append(i); throw new IllegalArgumentException(sb.toString().toString()); } /* loaded from: classes6.dex */ public static final class LWm implements Iterator, InterfaceC14932gcO { private final Iterator a; private int d; private gdH e; LWm(gdH gdh) { this.e = gdh; this.a = gdh.c.e(); } @Override // java.util.Iterator public final boolean hasNext() { d(); return this.d < this.e.b && this.a.hasNext(); } @Override // java.util.Iterator public final T next() { d(); if (this.d < this.e.b) { this.d++; return this.a.next(); } throw new NoSuchElementException(); } private final void d() { while (this.d < this.e.d && this.a.hasNext()) { this.a.next(); this.d++; } } @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 LWm(this); } @Override // o.gdA public final gdE d(int i) { int i2 = this.b; int i3 = this.d; return i >= i2 - i3 ? this : new gdH(this.c, i3, i + i3); } }