90 lines
2.8 KiB
Java
90 lines
2.8 KiB
Java
package d0.f0;
|
|
|
|
import d0.z.d.m;
|
|
import java.util.Iterator;
|
|
import java.util.NoSuchElementException;
|
|
import java.util.Objects;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.sequences.Sequence;
|
|
/* compiled from: Sequences.kt */
|
|
public final class i<T> implements Sequence<T> {
|
|
public final Function0<T> a;
|
|
public final Function1<T, T> b;
|
|
|
|
/* compiled from: Sequences.kt */
|
|
public static final class a implements Iterator<T>, d0.z.d.g0.a {
|
|
public T i;
|
|
public int j = -2;
|
|
public final /* synthetic */ i k;
|
|
|
|
public a(i iVar) {
|
|
this.k = iVar;
|
|
}
|
|
|
|
public final void a() {
|
|
T t;
|
|
if (this.j == -2) {
|
|
t = (T) i.access$getGetInitialValue$p(this.k).mo1invoke();
|
|
} else {
|
|
Function1 access$getGetNextValue$p = i.access$getGetNextValue$p(this.k);
|
|
T t2 = this.i;
|
|
m.checkNotNull(t2);
|
|
t = (T) access$getGetNextValue$p.invoke(t2);
|
|
}
|
|
this.i = t;
|
|
this.j = t == null ? 0 : 1;
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public boolean hasNext() {
|
|
if (this.j < 0) {
|
|
a();
|
|
}
|
|
return this.j == 1;
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public T next() {
|
|
if (this.j < 0) {
|
|
a();
|
|
}
|
|
if (this.j != 0) {
|
|
T t = this.i;
|
|
Objects.requireNonNull(t, "null cannot be cast to non-null type T");
|
|
this.j = -1;
|
|
return t;
|
|
}
|
|
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.jvm.functions.Function0<? extends T> */
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: kotlin.jvm.functions.Function1<? super T, ? extends T> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public i(Function0<? extends T> function0, Function1<? super T, ? extends T> function1) {
|
|
m.checkNotNullParameter(function0, "getInitialValue");
|
|
m.checkNotNullParameter(function1, "getNextValue");
|
|
this.a = function0;
|
|
this.b = function1;
|
|
}
|
|
|
|
public static final /* synthetic */ Function0 access$getGetInitialValue$p(i iVar) {
|
|
return iVar.a;
|
|
}
|
|
|
|
public static final /* synthetic */ Function1 access$getGetNextValue$p(i iVar) {
|
|
return iVar.b;
|
|
}
|
|
|
|
@Override // kotlin.sequences.Sequence
|
|
public Iterator<T> iterator() {
|
|
return new a(this);
|
|
}
|
|
}
|