Skip to content

Commit 671c398

Browse files
Merge pull request #1788 from benjchristensen/1785-remove-publish-overloads
Remove PublishLast/InitialValue
2 parents 81974c8 + 4bbc600 commit 671c398

File tree

2 files changed

+1
-100
lines changed

2 files changed

+1
-100
lines changed

src/main/java/rx/Observable.java

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -5347,105 +5347,6 @@ public final <R> Observable<R> publish(Func1<? super Observable<T>, ? extends Ob
53475347
return OperatorPublish.create(this, selector);
53485348
}
53495349

5350-
/**
5351-
* Returns an Observable that emits {@code initialValue} followed by the results of invoking a specified
5352-
* selector on items emitted by a {@link ConnectableObservable} that shares a single subscription to the
5353-
* source Observable.
5354-
* <p>
5355-
* <img width="640" height="510" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/publishConnect.if.png" alt="">
5356-
* <dl>
5357-
* <dt><b>Scheduler:</b></dt>
5358-
* <dd>{@code publish} does not operate by default on a particular {@link Scheduler}.</dd>
5359-
* </dl>
5360-
*
5361-
* @param <R>
5362-
* the type of items emitted by the resulting Observable
5363-
* @param selector
5364-
* a function that can use the multicasted source sequence as many times as needed, without
5365-
* causing multiple subscriptions to the source Observable. Subscribers to the source will
5366-
* receive all notifications of the source from the time of the subscription forward
5367-
* @param initialValue
5368-
* the initial value of the underlying {@link BehaviorSubject}
5369-
* @return an Observable that emits {@code initialValue} followed by the results of invoking the selector
5370-
* on a {@link ConnectableObservable} that shares a single subscription to the underlying Observable
5371-
* @see <a href="https://github.com/ReactiveX/RxJava/wiki/Connectable-Observable-Operators#observablepublish-and-observablemulticast">RxJava wiki: publish</a>
5372-
* @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.publish.aspx">MSDN: Observable.Publish</a>
5373-
*/
5374-
public final <R> Observable<R> publish(Func1<? super Observable<T>, ? extends Observable<R>> selector, final T initialValue) {
5375-
return concatWith(just(initialValue)).publish(selector);
5376-
}
5377-
5378-
/**
5379-
* Returns a {@link ConnectableObservable} that emits {@code initialValue} followed by the items emitted by
5380-
* the source Observable. A Connectable Observable resembles an ordinary Observable, except that it does not
5381-
* begin emitting items when it is subscribed to, but only when its {@code connect} method is called.
5382-
* <p>
5383-
* <img width="640" height="510" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/publishConnect.i.png" alt="">
5384-
* <dl>
5385-
* <dt><b>Scheduler:</b></dt>
5386-
* <dd>{@code publish} does not operate by default on a particular {@link Scheduler}.</dd>
5387-
* </dl>
5388-
*
5389-
* @param initialValue
5390-
* the initial value to be emitted by the resulting Observable
5391-
* @return a {@link ConnectableObservable} that shares a single subscription to the underlying Observable
5392-
* and starts with {@code initialValue}
5393-
* @see <a href="https://github.com/ReactiveX/RxJava/wiki/Connectable-Observable-Operators#observablepublish-and-observablemulticast">RxJava wiki: publish</a>
5394-
* @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.publish.aspx">MSDN: Observable.Publish</a>
5395-
*/
5396-
public final ConnectableObservable<T> publish(final T initialValue) {
5397-
return concatWith(just(initialValue)).publish();
5398-
}
5399-
5400-
/**
5401-
* Returns a {@link ConnectableObservable} that emits only the last item emitted by the source Observable.
5402-
* A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items
5403-
* when it is subscribed to, but only when its {@code connect} method is called.
5404-
* <p>
5405-
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/publishLast.png" alt="">
5406-
* <dl>
5407-
* <dt><b>Backpressure Support:</b></dt>
5408-
* <dd>This operator does not support backpressure because by intent it is skipping all values except the
5409-
* last.</dd>
5410-
* <dt><b>Scheduler:</b></dt>
5411-
* <dd>{@code publishLast} does not operate by default on a particular {@link Scheduler}.</dd>
5412-
* </dl>
5413-
*
5414-
* @return a {@link ConnectableObservable} that emits only the last item emitted by the source Observable
5415-
* @see <a href="https://github.com/ReactiveX/RxJava/wiki/Connectable-Observable-Operators#observablepublishlast">RxJava wiki: publishLast</a>
5416-
* @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.publishlast.aspx">MSDN: Observable.PublishLast</a>
5417-
*/
5418-
public final ConnectableObservable<T> publishLast() {
5419-
return takeLast(1).publish();
5420-
}
5421-
5422-
/**
5423-
* Returns an Observable that emits an item that results from invoking a specified selector on the last item
5424-
* emitted by a {@link ConnectableObservable} that shares a single subscription to the source Observable.
5425-
* <p>
5426-
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/publishLast.f.png" alt="">
5427-
* <dl>
5428-
* <dt><b>Backpressure Support:</b></dt>
5429-
* <dd>This operator does not support backpressure because by intent it is skipping all values except the
5430-
* last.</dd>
5431-
* <dt><b>Scheduler:</b></dt>
5432-
* <dd>{@code publishLast} does not operate by default on a particular {@link Scheduler}.</dd>
5433-
* </dl>
5434-
*
5435-
* @param <R>
5436-
* the type of items emitted by the resulting Observable
5437-
* @param selector
5438-
* a function that can use the multicasted source sequence as many times as needed, without
5439-
* causing multiple subscriptions to the source Observable. Subscribers to the source will only
5440-
* receive the last item emitted by the source.
5441-
* @return an Observable that emits an item that is the result of invoking the selector on a {@link ConnectableObservable} that shares a single subscription to the source Observable
5442-
* @see <a href="https://github.com/ReactiveX/RxJava/wiki/Connectable-Observable-Operators#observablepublishlast">RxJava wiki: publishLast</a>
5443-
* @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.publishlast.aspx">MSDN: Observable.PublishLast</a>
5444-
*/
5445-
public final <R> Observable<R> publishLast(Func1<? super Observable<T>, ? extends Observable<R>> selector) {
5446-
return takeLast(1).publish(selector);
5447-
}
5448-
54495350
/**
54505351
* Returns an Observable that applies a function of your choosing to the first item emitted by a source
54515352
* Observable, then feeds the result of that function along with the second item emitted by the source

src/test/java/rx/ObservableTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ public void run() {
517517
}
518518
}).start();
519519
}
520-
}).publishLast();
520+
}).takeLast(1).publish();
521521

522522
// subscribe once
523523
final CountDownLatch latch = new CountDownLatch(1);

0 commit comments

Comments
 (0)