@Test public void testFromLazyIterator() throws InterruptedException { PublishSubject<Integer> o1 = PublishSubject.create(); AtomicBoolean fetched = new AtomicBoolean(); Iterator<Integer> iter = Iterators.filter(Arrays.asList(1,2,3).iterator(), item->{fetched.set(true); return true;}); CountDownLatch latch = new CountDownLatch(3); AtomicReference<Throwable> error = new AtomicReference<>(); Observable<Integer> o2 = RxGuava.fromIterator(()->Futures.immediateFuture(iter), executor); Observable.concat(o1, o2).subscribe(item->latch.countDown(),e->error.set(e)); Thread.sleep(100); Assert.assertFalse("lazy future should not have been fetched yet", fetched.get()); o1.onCompleted(); Thread.sleep(50); Assert.assertTrue("lazy future should have been fetched by now", fetched.get()); Assert.assertNull(error.get()); }
public static <T> Observable<T> fromIterator(final ListenableFuture<Iterator<T>> futureIterator) { return fromIterator(futureIterator, MoreExecutors.sameThreadExecutor()); }
RxGuava { public static <T> Observable<T> fromIterator(final ListenableFuture<Iterator<T>> futureIterator) { return fromIterator(futureIterator, MoreExecutors.sameThreadExecutor()); } }
RxGuava { public static <T> Observable<T> fromIterator(final ListenableFuture<Iterator<T>> futureIterator) { return fromIterator(futureIterator, MoreExecutors.sameThreadExecutor()); }  }
RxGuava { public static <T> Observable<T> fromIterator(final ListenableFuture<Iterator<T>> futureIterator) { return fromIterator(futureIterator, MoreExecutors.sameThreadExecutor()); }  static Observable<T> fromIterator(final ListenableFuture<Iterator<T>> futureIterator); static Observable<T> fromIterable(final ListenableFuture<? extends Iterable<T>> futureIterable); static Observable<T> fromIterator(final Supplier<ListenableFuture<Iterator<T>>> futureIteratorSupplier); static Observable<T> fromIterator(final ListenableFuture<Iterator<T>> futureIterator,
      final Executor executor); static Observable<T> fromIterable(final ListenableFuture<? extends Iterable<T>> futureIterable,
      final Executor executor); static Observable<T> fromIterator(final Supplier<ListenableFuture<Iterator<T>>> futureIteratorSupplier,
      final Executor executor); static Observable<T> fromIterable(final Supplier<ListenableFuture<Iterable<T>>> futureSupplier,
      final Executor executor); static Observable<T> fromScalar(final ListenableFuture<T> future); static Observable<T> fromScalar(final Supplier<ListenableFuture<T>> futureSupplier); static Observable<T> fromScalar(final ListenableFuture<T> future, final Executor executor); static Observable<T> fromScalar(final Supplier<ListenableFuture<T>> futureSupplier, final Executor executor); }
RxGuava { public static <T> Observable<T> fromIterator(final ListenableFuture<Iterator<T>> futureIterator) { return fromIterator(futureIterator, MoreExecutors.sameThreadExecutor()); }  static Observable<T> fromIterator(final ListenableFuture<Iterator<T>> futureIterator); static Observable<T> fromIterable(final ListenableFuture<? extends Iterable<T>> futureIterable); static Observable<T> fromIterator(final Supplier<ListenableFuture<Iterator<T>>> futureIteratorSupplier); static Observable<T> fromIterator(final ListenableFuture<Iterator<T>> futureIterator,
      final Executor executor); static Observable<T> fromIterable(final ListenableFuture<? extends Iterable<T>> futureIterable,
      final Executor executor); static Observable<T> fromIterator(final Supplier<ListenableFuture<Iterator<T>>> futureIteratorSupplier,
      final Executor executor); static Observable<T> fromIterable(final Supplier<ListenableFuture<Iterable<T>>> futureSupplier,
      final Executor executor); static Observable<T> fromScalar(final ListenableFuture<T> future); static Observable<T> fromScalar(final Supplier<ListenableFuture<T>> futureSupplier); static Observable<T> fromScalar(final ListenableFuture<T> future, final Executor executor); static Observable<T> fromScalar(final Supplier<ListenableFuture<T>> futureSupplier, final Executor executor);  }