discord-jadx/app/src/main/java/d0/f0/r.java

106 lines
3.3 KiB
Java

package d0.f0;
import d0.z.d.m;
import java.util.Iterator;
import java.util.NoSuchElementException;
import kotlin.sequences.Sequence;
/* compiled from: Sequences.kt */
public final class r<T> implements Sequence<T>, e<T> {
public final Sequence<T> a;
public final int b;
/* renamed from: c reason: collision with root package name */
public final int f2698c;
/* compiled from: Sequences.kt */
public static final class a implements Iterator<T>, d0.z.d.g0.a {
public final Iterator<T> i;
public int j;
public final /* synthetic */ r k;
public a(r rVar) {
this.k = rVar;
this.i = r.access$getSequence$p(rVar).iterator();
}
public final void a() {
while (this.j < r.access$getStartIndex$p(this.k) && this.i.hasNext()) {
this.i.next();
this.j++;
}
}
@Override // java.util.Iterator
public boolean hasNext() {
a();
return this.j < r.access$getEndIndex$p(this.k) && this.i.hasNext();
}
@Override // java.util.Iterator
public T next() {
a();
if (this.j < r.access$getEndIndex$p(this.k)) {
this.j++;
return this.i.next();
}
throw new NoSuchElementException();
}
@Override // java.util.Iterator
public void remove() {
throw new UnsupportedOperationException("Operation is not supported for read-only collection");
}
}
/* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: kotlin.sequences.Sequence<? extends T> */
/* JADX WARN: Multi-variable type inference failed */
public r(Sequence<? extends T> sequence, int i, int i2) {
m.checkNotNullParameter(sequence, "sequence");
this.a = sequence;
this.b = i;
this.f2698c = i2;
boolean z2 = true;
if (i >= 0) {
if (i2 >= 0) {
if (!(i2 < i ? false : z2)) {
throw new IllegalArgumentException(c.d.b.a.a.n("endIndex should be not less than startIndex, but was ", i2, " < ", i).toString());
}
return;
}
throw new IllegalArgumentException(c.d.b.a.a.k("endIndex should be non-negative, but is ", i2).toString());
}
throw new IllegalArgumentException(c.d.b.a.a.k("startIndex should be non-negative, but is ", i).toString());
}
public static final /* synthetic */ int access$getEndIndex$p(r rVar) {
return rVar.f2698c;
}
public static final /* synthetic */ Sequence access$getSequence$p(r rVar) {
return rVar.a;
}
public static final /* synthetic */ int access$getStartIndex$p(r rVar) {
return rVar.b;
}
@Override // d0.f0.e
public Sequence<T> drop(int i) {
int i2 = this.f2698c;
int i3 = this.b;
return i >= i2 - i3 ? n.emptySequence() : new r(this.a, i3 + i, i2);
}
@Override // kotlin.sequences.Sequence
public Iterator<T> iterator() {
return new a(this);
}
@Override // d0.f0.e
public Sequence<T> take(int i) {
int i2 = this.f2698c;
int i3 = this.b;
return i >= i2 - i3 ? this : new r(this.a, i3, i + i3);
}
}