package o; import java.util.Iterator; /* loaded from: classes.dex */ public final class SJW extends ApF { private Iterator c; private YKU d; private final InterfaceC1244Ytw> i; private final Iterator j; public SJW(Iterator it, InterfaceC1244Ytw> interfaceC1244Ytw) { this.j = it; this.i = interfaceC1244Ytw; } @Override // o.ApF public final void b() { Iterator it = this.c; if (it != null && it.hasNext()) { this.b = this.c.next(); this.a = true; return; } while (this.j.hasNext()) { Iterator it2 = this.c; if (it2 == null || !it2.hasNext()) { YKU yku = this.d; if (yku != null) { yku.close(); this.d = null; } YKU d = this.i.d(this.j.next()); if (d != null) { this.c = d.b; this.d = d; } } Iterator it3 = this.c; if (it3 != null && it3.hasNext()) { this.b = this.c.next(); this.a = true; return; } } this.a = false; YKU yku2 = this.d; if (yku2 != null) { yku2.close(); this.d = null; } } }