From 4bbc6007f78f1512848562a30f8587e2cc3c55f1 Mon Sep 17 00:00:00 2001 From: Ben Christensen Date: Wed, 22 Oct 2014 23:11:33 -0700 Subject: [PATCH] Remove PublishLast/InitialValue See https://github.com/ReactiveX/RxJava/issues/1785 --- src/main/java/rx/Observable.java | 99 --------------------------- src/test/java/rx/ObservableTests.java | 2 +- 2 files changed, 1 insertion(+), 100 deletions(-) diff --git a/src/main/java/rx/Observable.java b/src/main/java/rx/Observable.java index 6e01458ae9..ddacc46af2 100644 --- a/src/main/java/rx/Observable.java +++ b/src/main/java/rx/Observable.java @@ -5347,105 +5347,6 @@ public final Observable publish(Func1, ? extends Ob return OperatorPublish.create(this, selector); } - /** - * Returns an Observable that emits {@code initialValue} followed by the results of invoking a specified - * selector on items emitted by a {@link ConnectableObservable} that shares a single subscription to the - * source Observable. - *

- * - *

- *
Scheduler:
- *
{@code publish} does not operate by default on a particular {@link Scheduler}.
- *
- * - * @param - * the type of items emitted by the resulting Observable - * @param selector - * a function that can use the multicasted source sequence as many times as needed, without - * causing multiple subscriptions to the source Observable. Subscribers to the source will - * receive all notifications of the source from the time of the subscription forward - * @param initialValue - * the initial value of the underlying {@link BehaviorSubject} - * @return an Observable that emits {@code initialValue} followed by the results of invoking the selector - * on a {@link ConnectableObservable} that shares a single subscription to the underlying Observable - * @see RxJava wiki: publish - * @see MSDN: Observable.Publish - */ - public final Observable publish(Func1, ? extends Observable> selector, final T initialValue) { - return concatWith(just(initialValue)).publish(selector); - } - - /** - * Returns a {@link ConnectableObservable} that emits {@code initialValue} followed by the items emitted by - * the source Observable. A Connectable Observable resembles an ordinary Observable, except that it does not - * begin emitting items when it is subscribed to, but only when its {@code connect} method is called. - *

- * - *

- *
Scheduler:
- *
{@code publish} does not operate by default on a particular {@link Scheduler}.
- *
- * - * @param initialValue - * the initial value to be emitted by the resulting Observable - * @return a {@link ConnectableObservable} that shares a single subscription to the underlying Observable - * and starts with {@code initialValue} - * @see RxJava wiki: publish - * @see MSDN: Observable.Publish - */ - public final ConnectableObservable publish(final T initialValue) { - return concatWith(just(initialValue)).publish(); - } - - /** - * Returns a {@link ConnectableObservable} that emits only the last item emitted by the source Observable. - * A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items - * when it is subscribed to, but only when its {@code connect} method is called. - *

- * - *

- *
Backpressure Support:
- *
This operator does not support backpressure because by intent it is skipping all values except the - * last.
- *
Scheduler:
- *
{@code publishLast} does not operate by default on a particular {@link Scheduler}.
- *
- * - * @return a {@link ConnectableObservable} that emits only the last item emitted by the source Observable - * @see RxJava wiki: publishLast - * @see MSDN: Observable.PublishLast - */ - public final ConnectableObservable publishLast() { - return takeLast(1).publish(); - } - - /** - * Returns an Observable that emits an item that results from invoking a specified selector on the last item - * emitted by a {@link ConnectableObservable} that shares a single subscription to the source Observable. - *

- * - *

- *
Backpressure Support:
- *
This operator does not support backpressure because by intent it is skipping all values except the - * last.
- *
Scheduler:
- *
{@code publishLast} does not operate by default on a particular {@link Scheduler}.
- *
- * - * @param - * the type of items emitted by the resulting Observable - * @param selector - * a function that can use the multicasted source sequence as many times as needed, without - * causing multiple subscriptions to the source Observable. Subscribers to the source will only - * receive the last item emitted by the source. - * @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 - * @see RxJava wiki: publishLast - * @see MSDN: Observable.PublishLast - */ - public final Observable publishLast(Func1, ? extends Observable> selector) { - return takeLast(1).publish(selector); - } - /** * Returns an Observable that applies a function of your choosing to the first item emitted by a source * Observable, then feeds the result of that function along with the second item emitted by the source diff --git a/src/test/java/rx/ObservableTests.java b/src/test/java/rx/ObservableTests.java index f68bf7ef69..9dec4e616f 100644 --- a/src/test/java/rx/ObservableTests.java +++ b/src/test/java/rx/ObservableTests.java @@ -517,7 +517,7 @@ public void run() { } }).start(); } - }).publishLast(); + }).takeLast(1).publish(); // subscribe once final CountDownLatch latch = new CountDownLatch(1);