I would like to suggest a new feature.
The observable.takeUntil function provides the following two types.
- takeUntil(ObservableSource<U> other)
- takeUntil(Predicate<? super T> stopPredicate)
TakeUntil, which combines the two sources, the first function. This controls until the first item is emitted as shown below.

The point at which takeUntil controls is when the first item is emit, not when onComplete is called.
here I thought.
'If it detects when the first item is emit, is it possible to support Single or Completable...etc as well as Observable?'
If this suggestion does not depart from the intent of takeUntil of reactiveX,
I want to make a Pull Request that adds the following function.
- takeUntil(SingleSource<U> other)
- takeUntil(MaybeSource<U> other)
- takeUntil(CompletableSource<U> other)
- takeUntil(FlowableSource<U> other)
If this goes depart from the intent, please tell me why.
Thanks!
I'm not convinced we need those dedicated variants. Use the appropriate conversion method.
There is, however, an outstanding request for Completable.takeUntil(Publisher) and/or Completable.takeUntil(ObservableSource).
hmm....
For example,
Only subscribe for 10 seconds
it would be implements like
observable.takeUntil(Observable.timer(10, SECONDS))
.subscribe(...);
Completable is enough, but should be used as Observable. And
I think there is a possibility of misrepresenting the meaning.
Of course, we can convert Completable to something like this,
but it does not look good.
observable.takeUntil(Completable.timer(10, SECONDS).toObservable())
.subscribe(...);
Then use Observable.timer() and there is no misinterpretation. If the particular source is not known exactly, use toObservable(), otherwise use the same reactive type on the until part as the main source.
Do we need to discuss for this topic?
If not, I will close the issue.