3232import io.reactivex.rxjava4.internal.operators.mixed.*;
3333import io.reactivex.rxjava4.internal.operators.observable.ObservableFromPublisher;
3434import io.reactivex.rxjava4.internal.operators.single.SingleToFlowable;
35+ import io.reactivex.rxjava4.internal.operators.streamable.StreamableFromPublisher;
3536import io.reactivex.rxjava4.internal.schedulers.ImmediateThinScheduler;
3637import io.reactivex.rxjava4.internal.subscribers.*;
3738import io.reactivex.rxjava4.internal.util.*;
@@ -16023,7 +16024,7 @@ public final void subscribe(@NonNull FlowableSubscriber<? super T> subscriber) {
1602316024 // can't call onSubscribe because the call might have set a Subscription already
1602416025 RxJavaPlugins.onError(e);
1602516026
16026- NullPointerException npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
16027+ var npe = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
1602716028 npe.initCause(e);
1602816029 throw npe;
1602916030 }
@@ -20928,7 +20929,7 @@ public final Stream<T> blockingStream(int prefetch) {
2092820929 * {@code ExecutorService} uses virtual threads, such as the one returned by
2092920930 * {@link Executors#newVirtualThreadPerTaskExecutor()}.
2093020931 * @param <R> the downstream element type
20931- * @param transformer the callback whose {@link VirtualTransformer#transform(Object, VirtualEmitter)}
20932+ * @param transformer the callback whose {@link VirtualTransformer#transform(Object, VirtualEmitter, Disposable )}
2093220933 * is invoked for each upstream item
2093320934 * @param executor the target {@code ExecutorService} to use for running the callback
2093420935 * @return the new {@code Flowable} instance
@@ -20961,7 +20962,7 @@ public final Stream<T> blockingStream(int prefetch) {
2096120962 * {@link Scheduler} uses virtual threads, such as the one returned by
2096220963 * {@link Executors#newVirtualThreadPerTaskExecutor()}.
2096320964 * @param <R> the downstream element type
20964- * @param transformer the callback whose {@link VirtualTransformer#transform(Object, VirtualEmitter)}
20965+ * @param transformer the callback whose {@link VirtualTransformer#transform(Object, VirtualEmitter, Disposable )}
2096520966 * is invoked for each upstream item
2096620967 * @return the new {@code Flowable} instance
2096720968 * @throws NullPointerException if {@code transformer} is {@code null}
@@ -20992,7 +20993,7 @@ public final Stream<T> blockingStream(int prefetch) {
2099220993 * {@code Scheduler} uses virtual threads, such as the one returned by
2099320994 * {@link Schedulers#virtual()}.
2099420995 * @param <R> the downstream element type
20995- * @param transformer the callback whose {@link VirtualTransformer#transform(Object, VirtualEmitter)}
20996+ * @param transformer the callback whose {@link VirtualTransformer#transform(Object, VirtualEmitter, Disposable )}
2099620997 * is invoked for each upstream item
2099720998 * @param scheduler the target {@code Scheduler} to use for running the callback
2099820999 * @param prefetch the number of items to fetch from the upstream.
@@ -21030,7 +21031,7 @@ public final Stream<T> blockingStream(int prefetch) {
2103021031 * {@code ExecutorService} uses virtual threads, such as the one returned by
2103121032 * {@link Executors#newVirtualThreadPerTaskExecutor()}.
2103221033 * @param <R> the downstream element type
21033- * @param transformer the callback whose {@link VirtualTransformer#transform(Object, VirtualEmitter)}
21034+ * @param transformer the callback whose {@link VirtualTransformer#transform(Object, VirtualEmitter, Disposable )}
2103421035 * is invoked for each upstream item
2103521036 * @param executor the target {@code ExecutorService} to use for running the callback
2103621037 * @param prefetch the number of items to fetch from the upstream.
@@ -21051,4 +21052,54 @@ public final Stream<T> blockingStream(int prefetch) {
2105121052 return new FlowableVirtualTransformExecutor<>(this, transformer, executor, null, prefetch);
2105221053 }
2105321054
21055+ /**
21056+ * Converts this {@code Flowable} into a {@link Streamable} instance,
21057+ * transparently relaying signals between the two async representations of a sequence.
21058+ * <p>
21059+ * <dl>
21060+ * <dt><b>Backpressure:</b></dt>
21061+ * <dd>This operator requests from the upstream in a bounded manner and
21062+ * relays the values one-by-one to the {@link Streamer } view of the sequence.
21063+ * </dd>
21064+ * <dt><b>Scheduler:</b></dt>
21065+ * <dd>The operator by design runs on the default virtual executor of the system.</dd>
21066+ * </dl>
21067+ * <p>
21068+ * @return the new {@code Streamable} instance
21069+ * @since 4.0.0
21070+ */
21071+ @CheckReturnValue
21072+ @BackpressureSupport(BackpressureKind.FULL)
21073+ @SchedulerSupport(SchedulerSupport.VIRTUAL)
21074+ @NonNull
21075+ public final Streamable<T> toStreamable() {
21076+ return toStreamable(Executors.newVirtualThreadPerTaskExecutor());
21077+ }
21078+
21079+ /**
21080+ * Converts this {@code Flowable} into a {@link Streamable} instance,
21081+ * transparently relaying signals between the two async representations of a sequence.
21082+ * <p>
21083+ * <dl>
21084+ * <dt><b>Backpressure:</b></dt>
21085+ * <dd>This operator requests from the upstream in a bounded manner and
21086+ * relays the values one-by-one to the {@link Streamer } view of the sequence.
21087+ * </dd>
21088+ * <dt><b>Scheduler:</b></dt>
21089+ * <dd>The operator runs on the provided {@link ExecutorService}.</dd>
21090+ * </dl>
21091+ * <p>
21092+ * @param executor where the coordination will happen
21093+ * @return the new {@code Streamable} instance
21094+ * @throws NullPointerException if {@code executor} is {@code null}
21095+ * @since 4.0.0
21096+ */
21097+ @CheckReturnValue
21098+ @BackpressureSupport(BackpressureKind.FULL)
21099+ @SchedulerSupport(SchedulerSupport.NONE)
21100+ @NonNull
21101+ public final Streamable<T> toStreamable(ExecutorService executor) {
21102+ Objects.requireNonNull(executor, "executor is null");
21103+ return new StreamableFromPublisher<>(this, executor);
21104+ }
2105421105}
0 commit comments