/** * Returns an {@code Observable} that stays connected to this {@code ConnectableObservable} as long as there * is at least one subscription to this {@code ConnectableObservable}. * * @return an {@link Observable} * @see <a href="http://reactivex.io/documentation/operators/refcount.html">ReactiveX documentation: RefCount</a> */ @NonNull public Observable<T> refCount() { return RxJavaObservablePlugins.onAssembly(new ObservableRefCount<T>(this)); }
/** * Returns an {@code Observable} that stays connected to this {@code ConnectableObservable} as long as there * is at least one subscription to this {@code ConnectableObservable}. * * @return an {@link Observable} * @see <a href="http://reactivex.io/documentation/operators/refcount.html">ReactiveX documentation: RefCount</a> */ @NonNull public Observable<T> refCount() { return RxJavaObservablePlugins.onAssembly(new ObservableRefCount<T>(this)); }
private Single<T> timeout0(final long timeout, final TimeUnit unit, final Scheduler scheduler, final SingleSource<? extends T> other) { ObjectHelper.requireNonNull(unit, "unit is null"); ObjectHelper.requireNonNull(scheduler, "scheduler is null"); return RxJavaObservablePlugins.onAssembly(new SingleTimeout<T>(this, timeout, unit, scheduler, other)); }
private Observable<T> timeout0(long timeout, TimeUnit timeUnit, ObservableSource<? extends T> other, Scheduler scheduler) { ObjectHelper.requireNonNull(timeUnit, "timeUnit is null"); ObjectHelper.requireNonNull(scheduler, "scheduler is null"); return RxJavaObservablePlugins.onAssembly(new ObservableTimeoutTimed<T>(this, timeout, timeUnit, scheduler, other)); }
/** * Creates a cached Observable with the given capacity hint. * @param <T> the value type * @param source the source Observable to cache * @param capacityHint the hint for the internal buffer size * @return the CachedObservable instance */ public static <T> Observable<T> from(Observable<T> source, int capacityHint) { ObjectHelper.verifyPositive(capacityHint, "capacityHint"); CacheState<T> state = new CacheState<T>(source, capacityHint); return RxJavaObservablePlugins.onAssembly(new ObservableCache<T>(source, state)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> elementAtOrError(Flowable<T> source, long index) { ObjectHelper.requireNonNull(source, "source is null"); if (index < 0) { throw new IndexOutOfBoundsException("index >= 0 required but it was " + index); } return RxJavaObservablePlugins.onAssembly(new FlowableElementAtSingle<T>(source, index, null)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> elementAt(Flowable<T> source, long index, T defaultItem) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(defaultItem, "defaultItem is null"); if (index < 0L) { throw new IndexOutOfBoundsException("index >= 0 required but it was " + index); } return RxJavaObservablePlugins.onAssembly(new FlowableElementAtSingle<T>(source, index, defaultItem)); }
@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> Maybe<T> lastElement(Flowable<T> source) { ObjectHelper.requireNonNull(source, "source is null"); return RxJavaObservablePlugins.onAssembly(new FlowableLastMaybe<T>(source)); }
@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> 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, U> Single<T> takeUntil(Single<T> source, Publisher<U> other) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(other, "other is null"); return RxJavaObservablePlugins.onAssembly(new SingleTakeUntilPublisher<T, U>(source, other)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<Boolean> any(Flowable<T> source, Predicate<? super T> predicate) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(predicate, "predicate is null"); return RxJavaObservablePlugins.onAssembly(new FlowableAnySingle<T>(source, predicate)); }
@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)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T, R> Single<R> reduceWith(Flowable<T> source, Callable<R> seed, BiFunction<R, ? super T, R> reducer) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(seed, "seed is null"); ObjectHelper.requireNonNull(reducer, "reducer is null"); return RxJavaObservablePlugins.onAssembly(new FlowableReduceWithSingle<T, R>(source, seed, reducer)); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Completable flatMapCompletable(Flowable<T> source, Function<? super T, ? extends CompletableSource> mapper, boolean delayError, int prefetch) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaObservablePlugins.onAssembly(new FlowableFlatMapCompletableCompletable<T>(source, mapper, delayError, prefetch)); }