148 lines
4.5 KiB
Java
148 lines
4.5 KiB
Java
|
package o;
|
||
|
|
||
|
import java.util.Iterator;
|
||
|
import java.util.NoSuchElementException;
|
||
|
import java.util.concurrent.ArrayBlockingQueue;
|
||
|
import java.util.concurrent.BlockingQueue;
|
||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||
|
|
||
|
/* renamed from: o.fVb, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes6.dex */
|
||
|
public final class C13258fVb<T> implements Iterable<T> {
|
||
|
private InterfaceC13169fSq<T> a;
|
||
|
|
||
|
public C13258fVb(InterfaceC13169fSq<T> interfaceC13169fSq) {
|
||
|
this.a = interfaceC13169fSq;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Iterable
|
||
|
public final Iterator<T> iterator() {
|
||
|
return new LWm(this.a, new HBt());
|
||
|
}
|
||
|
|
||
|
/* renamed from: o.fVb$LWm */
|
||
|
/* loaded from: classes6.dex */
|
||
|
static final class LWm<T> implements Iterator<T> {
|
||
|
private final InterfaceC13169fSq<T> a;
|
||
|
private T b;
|
||
|
private Throwable d;
|
||
|
private final HBt<T> h;
|
||
|
private boolean j;
|
||
|
private boolean e = true;
|
||
|
private boolean c = true;
|
||
|
|
||
|
LWm(InterfaceC13169fSq<T> interfaceC13169fSq, HBt<T> hBt) {
|
||
|
this.a = interfaceC13169fSq;
|
||
|
this.h = hBt;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Iterator
|
||
|
public final boolean hasNext() {
|
||
|
Throwable th = this.d;
|
||
|
if (th != null) {
|
||
|
throw fYR.c(th);
|
||
|
}
|
||
|
if (this.e) {
|
||
|
return !this.c || e();
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
private boolean e() {
|
||
|
if (!this.j) {
|
||
|
this.j = true;
|
||
|
this.h.d.set(1);
|
||
|
new fWE(this.a).subscribe(this.h);
|
||
|
}
|
||
|
try {
|
||
|
HBt<T> hBt = this.h;
|
||
|
hBt.d.set(1);
|
||
|
C13166fSn<T> take = hBt.c.take();
|
||
|
Object obj = take.a;
|
||
|
Throwable th = (T) null;
|
||
|
if (obj != null && !fYX.b(obj)) {
|
||
|
this.c = false;
|
||
|
Object obj2 = take.a;
|
||
|
Object obj3 = th;
|
||
|
if (obj2 != null) {
|
||
|
obj3 = th;
|
||
|
if (!fYX.b(obj2)) {
|
||
|
obj3 = (T) take.a;
|
||
|
}
|
||
|
}
|
||
|
this.b = (T) obj3;
|
||
|
return true;
|
||
|
}
|
||
|
this.e = false;
|
||
|
if (take.a == null) {
|
||
|
return false;
|
||
|
}
|
||
|
Object obj4 = take.a;
|
||
|
Throwable th2 = th;
|
||
|
if (fYX.b(obj4)) {
|
||
|
th2 = (T) fYX.a(obj4);
|
||
|
}
|
||
|
this.d = th2;
|
||
|
throw fYR.c(th2);
|
||
|
} catch (InterruptedException e) {
|
||
|
this.h.dispose();
|
||
|
this.d = e;
|
||
|
throw fYR.c(e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Iterator
|
||
|
public final T next() {
|
||
|
Throwable th = this.d;
|
||
|
if (th != null) {
|
||
|
throw fYR.c(th);
|
||
|
}
|
||
|
if (!hasNext()) {
|
||
|
throw new NoSuchElementException("No more elements");
|
||
|
}
|
||
|
this.c = true;
|
||
|
return this.b;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Iterator
|
||
|
public final void remove() {
|
||
|
throw new UnsupportedOperationException("Read only iterator");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: o.fVb$HBt */
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static final class HBt<T> extends AbstractC13403fZf<C13166fSn<T>> {
|
||
|
final BlockingQueue<C13166fSn<T>> c = new ArrayBlockingQueue(1);
|
||
|
final AtomicInteger d = new AtomicInteger();
|
||
|
|
||
|
@Override // o.InterfaceC13174fSv
|
||
|
public final void onComplete() {
|
||
|
}
|
||
|
|
||
|
HBt() {
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13174fSv
|
||
|
public final /* synthetic */ void onNext(Object obj) {
|
||
|
Object obj2;
|
||
|
Object obj3;
|
||
|
C13166fSn<T> c13166fSn = (C13166fSn) obj;
|
||
|
if (this.d.getAndSet(0) == 1 || (obj3 = c13166fSn.a) == null || fYX.b(obj3)) {
|
||
|
while (!this.c.offer(c13166fSn)) {
|
||
|
C13166fSn<T> poll = this.c.poll();
|
||
|
if (poll != null && ((obj2 = poll.a) == null || fYX.b(obj2))) {
|
||
|
c13166fSn = poll;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13174fSv
|
||
|
public final void onError(Throwable th) {
|
||
|
C13418fZu.c(th);
|
||
|
}
|
||
|
}
|
||
|
}
|