what-the-bank/sources/o/C13207fTu.java

135 lines
4.4 KiB
Java

package o;
import java.util.Iterator;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream;
/* renamed from: o.fTu, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13207fTu<T, R> extends AbstractC13163fSk<R> {
private fSS<? super T, ? extends Stream<? extends R>> b;
private AbstractC13163fSk<T> d;
public C13207fTu(AbstractC13163fSk<T> abstractC13163fSk, fSS<? super T, ? extends Stream<? extends R>> fss) {
this.d = abstractC13163fSk;
this.b = fss;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super R> interfaceC13174fSv) {
AbstractC13163fSk<T> abstractC13163fSk = this.d;
if (abstractC13163fSk instanceof InterfaceC13189fTc) {
try {
Object d = ((InterfaceC13189fTc) abstractC13163fSk).d();
Stream stream = d != null ? (Stream) Objects.requireNonNull(this.b.a(d), "The mapper returned a null Stream") : null;
if (stream != null) {
C13206fTt.c(interfaceC13174fSv, stream);
return;
} else {
EnumC13195fTi.e(interfaceC13174fSv);
return;
}
} catch (Throwable th) {
C13147fSI.c(th);
EnumC13195fTi.a(th, interfaceC13174fSv);
return;
}
}
abstractC13163fSk.subscribe(new IeS(interfaceC13174fSv, this.b));
}
/* renamed from: o.fTu$IeS */
/* loaded from: classes6.dex */
static final class IeS<T, R> extends AtomicInteger implements InterfaceC13174fSv<T>, fSJ {
private fSS<? super T, ? extends Stream<? extends R>> a;
private fSJ b;
private volatile boolean c;
private boolean d;
private InterfaceC13174fSv<? super R> e;
IeS(InterfaceC13174fSv<? super R> interfaceC13174fSv, fSS<? super T, ? extends Stream<? extends R>> fss) {
this.e = interfaceC13174fSv;
this.a = fss;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
if (EnumC13192fTf.d(this.b, fsj)) {
this.b = fsj;
this.e.onSubscribe(this);
}
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
if (this.d) {
return;
}
try {
Stream stream = (Stream) Objects.requireNonNull(this.a.a(t), "The mapper returned a null Stream");
try {
Iterator<T> it = stream.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
if (this.c) {
this.d = true;
break;
}
Object requireNonNull = Objects.requireNonNull(it.next(), "The Stream's Iterator.next returned a null value");
if (this.c) {
this.d = true;
break;
}
this.e.onNext(requireNonNull);
if (this.c) {
this.d = true;
break;
}
}
if (stream != null) {
stream.close();
}
} finally {
}
} catch (Throwable th) {
C13147fSI.c(th);
this.b.dispose();
onError(th);
}
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (this.d) {
C13418fZu.c(th);
} else {
this.d = true;
this.e.onError(th);
}
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
if (this.d) {
return;
}
this.d = true;
this.e.onComplete();
}
@Override // o.fSJ
public final void dispose() {
this.c = true;
this.b.dispose();
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.c;
}
}
}