@Test public void testNextWithCallingHasNextMultipleTimes() { Subject<String, String> obs = PublishSubject.create(); Iterator<String> it = next(obs).iterator(); fireOnNextInNewThread(obs, "one"); assertTrue(it.hasNext()); assertTrue(it.hasNext()); assertTrue(it.hasNext()); assertTrue(it.hasNext()); assertEquals("one", it.next()); obs.onCompleted(); try { it.next(); fail("At the end of an iterator should throw a NoSuchElementException"); } catch (NoSuchElementException e) { } }
public static <T> Iterable<T> next(final Observable<? extends T> items) { return new Iterable<T>() { @Override public Iterator<T> iterator() { NextObserver<T> nextObserver = new NextObserver<T>(); return new NextIterator<T>(items, nextObserver); } }; }
BlockingOperatorNext { public static <T> Iterable<T> next(final Observable<? extends T> items) { return new Iterable<T>() { @Override public Iterator<T> iterator() { NextObserver<T> nextObserver = new NextObserver<T>(); return new NextIterator<T>(items, nextObserver); } }; } }
BlockingOperatorNext { public static <T> Iterable<T> next(final Observable<? extends T> items) { return new Iterable<T>() { @Override public Iterator<T> iterator() { NextObserver<T> nextObserver = new NextObserver<T>(); return new NextIterator<T>(items, nextObserver); } }; } private  BlockingOperatorNext(); }
BlockingOperatorNext { public static <T> Iterable<T> next(final Observable<? extends T> items) { return new Iterable<T>() { @Override public Iterator<T> iterator() { NextObserver<T> nextObserver = new NextObserver<T>(); return new NextIterator<T>(items, nextObserver); } }; } private  BlockingOperatorNext(); static Iterable<T> next(final Observable<? extends T> items); }
BlockingOperatorNext { public static <T> Iterable<T> next(final Observable<? extends T> items) { return new Iterable<T>() { @Override public Iterator<T> iterator() { NextObserver<T> nextObserver = new NextObserver<T>(); return new NextIterator<T>(items, nextObserver); } }; } private  BlockingOperatorNext(); static Iterable<T> next(final Observable<? extends T> items);  }