code: @NullableDecl
    static <T> T pollNext(Iterator<T> iterator) {
      if (iterator.hasNext()) {
        T result = iterator.next();
        iterator.remove();
        return result;
      } else {
        return null;
      }
    }
docs: Deletes and returns the next value from the iterator, or returns {@code null} if there is no
  such value.