public static @NotNull <E> JBIterable<@NotNull E> generate(@Nullable E first1, @Nullable E first2,
                                                             @NotNull PairFunction<? super E, ? super E, ? extends E> generator) {
    if (first1 == null) return empty();
    return new JBIterable<E>() {
      @Override
      public Iterator<E> iterator() {
        return new JBIterator<E>() {
          E cur1 = first1;
          E cur2 = first2;

          @Override
          public E nextImpl() {
            E result = cur1;
            cur1 = cur2;
            cur2 = generator.fun(result, cur2);
            if (result == null) return stop();
            return result;
          }
        };
      }
    };
  }
public static @NotNull <E> JBIterable<@NotNull E> generate(@Nullable E first1, @Nullable E first2,
                                                             @NotNull PairFunction<? super E, ? super E, ? extends E> generator)