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

190 lines
5.8 KiB
Java

package o;
import android.R;
import java.util.Iterator;
import java.util.Objects;
import java.util.stream.Stream;
/* renamed from: o.fTt, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13206fTt<T> extends AbstractC13163fSk<T> {
private Stream<T> d;
public C13206fTt(Stream<T> stream) {
this.d = stream;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
c(interfaceC13174fSv, this.d);
}
public static <T> void c(InterfaceC13174fSv<? super T> interfaceC13174fSv, Stream<T> stream) {
try {
Iterator<T> it = stream.iterator();
if (!it.hasNext()) {
EnumC13195fTi.e(interfaceC13174fSv);
try {
stream.close();
return;
} catch (Throwable th) {
C13147fSI.c(th);
C13418fZu.c(th);
return;
}
}
Sts sts = new Sts(interfaceC13174fSv, it, stream);
interfaceC13174fSv.onSubscribe(sts);
sts.a();
} catch (Throwable th2) {
C13147fSI.c(th2);
EnumC13195fTi.a(th2, interfaceC13174fSv);
try {
stream.close();
} catch (Throwable th3) {
C13147fSI.c(th3);
C13418fZu.c(th3);
}
}
}
static void d(AutoCloseable autoCloseable) {
try {
autoCloseable.close();
} catch (Throwable th) {
C13147fSI.c(th);
C13418fZu.c(th);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.fTt$Sts */
/* loaded from: classes6.dex */
public static final class Sts<T> implements InterfaceC13412fZo<T> {
private AutoCloseable a;
private volatile boolean b;
private InterfaceC13174fSv<? super T> c;
private boolean d;
private Iterator<T> e;
private boolean j;
Sts(InterfaceC13174fSv<? super T> interfaceC13174fSv, Iterator<T> it, AutoCloseable autoCloseable) {
this.c = interfaceC13174fSv;
this.e = it;
this.a = autoCloseable;
}
@Override // o.fSJ
public final void dispose() {
this.b = true;
a();
}
@Override // o.InterfaceC13414fZq
public final boolean b(T t) {
throw new UnsupportedOperationException();
}
@Override // o.InterfaceC13414fZq
public final T b() {
Iterator<T> it = this.e;
if (it == null) {
return null;
}
if (!this.d) {
this.d = true;
} else if (!it.hasNext()) {
this.e = null;
AutoCloseable autoCloseable = this.a;
this.a = null;
if (autoCloseable != null) {
C13206fTt.d(autoCloseable);
}
return null;
}
return (T) Objects.requireNonNull(this.e.next(), "The Stream's Iterator.next() returned a null value");
}
@Override // o.InterfaceC13414fZq
public final boolean c() {
Iterator<T> it = this.e;
if (it == null) {
return true;
}
if (!this.d || it.hasNext()) {
return false;
}
this.e = null;
AutoCloseable autoCloseable = this.a;
this.a = null;
if (autoCloseable == null) {
return true;
}
C13206fTt.d(autoCloseable);
return true;
}
@Override // o.InterfaceC13414fZq
public final void e() {
this.e = null;
AutoCloseable autoCloseable = this.a;
this.a = null;
if (autoCloseable != null) {
C13206fTt.d(autoCloseable);
}
}
public final void a() {
if (this.j) {
return;
}
Iterator<T> it = this.e;
InterfaceC13174fSv<? super T> interfaceC13174fSv = this.c;
while (!this.b) {
try {
R.color colorVar = (Object) Objects.requireNonNull(it.next(), "The Stream's Iterator.next returned a null value");
if (!this.b) {
interfaceC13174fSv.onNext(colorVar);
if (!this.b) {
try {
if (!it.hasNext()) {
interfaceC13174fSv.onComplete();
this.b = true;
}
} catch (Throwable th) {
C13147fSI.c(th);
interfaceC13174fSv.onError(th);
this.b = true;
}
}
}
} catch (Throwable th2) {
C13147fSI.c(th2);
interfaceC13174fSv.onError(th2);
this.b = true;
}
}
this.e = null;
AutoCloseable autoCloseable = this.a;
this.a = null;
if (autoCloseable != null) {
C13206fTt.d(autoCloseable);
}
}
@Override // o.InterfaceC13413fZp
public final int b(int i) {
if ((i & 1) == 0) {
return 0;
}
this.j = true;
return 1;
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.b;
}
}
}