void fastPath() { final Iterator<? extends T> a = iterator; final Subscriber<? super T> s = actual; for (; ; ) { if (cancelled) { return; } T t; try { t = a.next(); } catch (Exception ex) { s.onError(ex); return; } if (cancelled) { return; } if (t == null) { s.onError(new NullPointerException("The iterator returned a null value")); return; } s.onNext(t); if (cancelled) { return; } boolean b; try { b = a.hasNext(); } catch (Exception ex) { s.onError(ex); return; } if (cancelled) { return; } if (!b) { s.onComplete(); return; } } }
void slowPath(long n) { final Iterator<? extends T> a = iterator; final Subscriber<? super T> s = actual; long e = 0L; for (; ; ) { while (e != n) { T t; try { t = a.next(); } catch (Throwable ex) { s.onError(ex); return; } if (cancelled) { return; } if (t == null) { s.onError(new NullPointerException("The iterator returned a null value")); return; } s.onNext(t); if (cancelled) { return; } boolean b; try { b = a.hasNext(); } catch (Throwable ex) { s.onError(ex); return; } if (cancelled) { return; } if (!b) { s.onComplete(); return; } e++; } n = requested; if (n == e) { n = REQUESTED.addAndGet(this, -e); if (n == 0L) { return; } e = 0L; } } }