/**
   * Common method to take an Iterator as a source of values.
   *
   * @param s
   * @param it
   */
  static <T> void subscribe(Subscriber<? super T> s, Iterator<? extends T> it) {
    if (it == null) {
      EmptySubscription.error(s, new NullPointerException("The iterator is null"));
      return;
    }

    boolean b;

    try {
      b = it.hasNext();
    } catch (Throwable e) {
      EmptySubscription.error(s, e);
      return;
    }
    if (!b) {
      EmptySubscription.complete(s);
      return;
    }

    s.onSubscribe(new PublisherIterableSubscription<>(s, it));
  }
  @Override
  public void subscribe(Subscriber<? super T> s) {
    Iterator<? extends T> it;

    try {
      it = iterable.iterator();
    } catch (Throwable e) {
      EmptySubscription.error(s, e);
      return;
    }

    subscribe(s, it);
  }