/** * Creates an UnicastSubject with the given internal buffer capacity hint. * @param <T> the value type * @param capacityHint the hint to size the internal unbounded buffer * @return an UnicastSubject instance */ @CheckReturnValue public static <T> UnicastSubject<T> create(int capacityHint) { return new UnicastSubject<T>(capacityHint, true); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Completable mergeCompletableDelayError(Flowable<? extends CompletableSource> sources) { return mergeCompletableDelayError(sources, Integer.MAX_VALUE); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> firstOrError(Flowable<T> source) { return elementAtOrError(source, 0); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T, R> Flowable<R> flatMapPublisher(Maybe<T> source, Function<? super T, ? extends Publisher<? extends R>> mapper) { return toFlowable(source).flatMap(mapper); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Completable concatCompletable(Flowable<? extends CompletableSource> sources) { ObjectHelper.requireNonNull(sources, "sources is null"); return concatCompletable(sources, 2); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<List<T>> toList(Flowable<T> source) { ObjectHelper.requireNonNull(source, "source is null"); return RxJavaObservablePlugins.onAssembly(new FlowableToListSingle<T, List<T>>(source)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> singleOrError(Flowable<T> source) { ObjectHelper.requireNonNull(source, "source is null"); return RxJavaObservablePlugins.onAssembly(new FlowableSingleSingle<T>(source, null)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Flowable<T> concatMaybeArray(MaybeSource<? extends T>... sources) { ObjectHelper.requireNonNull(sources, "sources is null"); return RxJavaFlowablePlugins.onAssembly(new MaybeConcatArray<T>(sources)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Flowable<T> concatMaybeIterable(Iterable<? extends MaybeSource<? extends T>> sources) { ObjectHelper.requireNonNull(sources, "sources is null"); return RxJavaFlowablePlugins.onAssembly(new MaybeConcatIterable<T>(sources)); }
/** * Filters the source values on each 'rail'. * <p> * Note that the same predicate may be called from multiple threads concurrently. * @param predicate the function returning true to keep a value or false to drop a value * @return the new ParallelFlowable instance */ @CheckReturnValue public final ParallelFlowable<T> filter(@NonNull Predicate<? super T> predicate) { ObjectHelper.requireNonNull(predicate, "predicate"); return RxJavaFlowablePlugins.onAssembly(new ParallelFilter<T>(this, predicate)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T, C extends Collection<? super T>> Single<C> toList(Flowable<T> source, Callable<C> collectionSupplier) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(collectionSupplier, "collectionSupplier is null"); return RxJavaObservablePlugins.onAssembly(new FlowableToListSingle<T, C>(source, collectionSupplier)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T, R> Flowable<R> flatMapMaybe(Flowable<T> source, Function<? super T, ? extends MaybeSource<? extends R>> mapper) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(mapper, "mapper is null"); return flatMapMaybe(source, mapper, false, Flowable.bufferSize()); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T, R> Flowable<R> flattenAsFlowable(Single<T> source, Function<? super T, ? extends Iterable<? extends R>> mapper) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(mapper, "mapper is null"); return RxJavaFlowablePlugins.onAssembly(new SingleFlatMapIterableFlowable<T, R>(source, mapper)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Completable concatCompletable(Flowable<? extends CompletableSource> sources, int prefetch) { ObjectHelper.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaObservablePlugins.onAssembly(new CompletableConcat(sources, prefetch)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> last(Flowable<T> source, T defaultItem) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(defaultItem, "defaultItem is null"); return RxJavaObservablePlugins.onAssembly(new FlowableLastSingle<T>(source, defaultItem)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T, U> Maybe<T> takeUntil(Maybe<T> source, Publisher<U> other) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(other, "other is null"); return RxJavaObservablePlugins.onAssembly(new MaybeTakeUntilPublisher<T, U>(source, other)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T, R> Flowable<R> flatMapSingle(Flowable<T> source, Function<? super T, ? extends SingleSource<? extends R>> mapper, boolean delayError, int maxConcurrency) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); return RxJavaFlowablePlugins.onAssembly(new FlowableFlatMapSingle<T, R>(source, mapper, delayError, maxConcurrency)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @SuppressWarnings({ "unchecked", "rawtypes" }) public static <T> Flowable<T> concatSingle(Flowable<? extends Single<? extends T>> sources, int prefetch) { ObjectHelper.requireNonNull(sources, "sources is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaFlowablePlugins.onAssembly(new FlowableConcatMapPublisher(sources, InteropInternalHelper.toFlowable(), prefetch, ErrorMode.IMMEDIATE)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T, C> Single<C> collect(Flowable<T> source, Callable<C> collectionSupplier, BiConsumer<? super C, ? super T> collector) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(collectionSupplier, "collectionSupplier is null"); ObjectHelper.requireNonNull(collector, "collector is null"); return RxJavaObservablePlugins.onAssembly(new FlowableCollectSingle<T, C>(source, collectionSupplier, collector)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T, U> Maybe<T> timeout(Maybe<T> source, Publisher<U> other, Maybe<T> fallback) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(other, "other is null"); ObjectHelper.requireNonNull(fallback, "fallback is null"); return RxJavaObservablePlugins.onAssembly(new MaybeTimeoutPublisher<T, U>(source, other, fallback)); }