You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Create an observable sequence that is the result of invoking the
5241
+
* selector on a connectable observable sequence that shares a single
5242
+
* subscription to the underlying sequence.
5243
+
* @param <R> the result type
5244
+
* @param selector function which can use the multicasted source
5245
+
* sequence as many times as needed, without causing multiple
5246
+
* subscriptions to the source sequence. Subscribers to the given
5247
+
* source will receive all notifications of the source from the time
5248
+
* of the subscription on.
5249
+
* @return an observable sequence that is the result of invoking the
5250
+
* selector on a connectable observable sequence that shares a single
5251
+
* subscription to the underlying sequence.
5252
+
*/
5253
+
public <R> Observable<R> publish(Func1<Observable<T>, Observable<R>> selector) {
5254
+
returnmulticast(newFunc0<Subject<T, T>>() {
5255
+
@Override
5256
+
publicSubject<T, T> call() {
5257
+
returnPublishSubject.create();
5258
+
}
5259
+
}, selector);
5260
+
}
5261
+
5262
+
/**
5263
+
* Create an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
5264
+
* @param <R> the result type
5265
+
* @param selector function which can use the multicasted source
5266
+
* sequence as many times as needed, without causing multiple
5267
+
* subscriptions to the source sequence. Subscribers to the given
5268
+
* source will receive all notifications of the source from the time
5269
+
* of the subscription on
5270
+
* @param initialValue the initial value of the underlying BehaviorSubject
5271
+
* @return an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue
5272
+
*/
5273
+
public <R> Observable<R> publish(Func1<Observable<T>, Observable<R>> selector, finalTinitialValue) {
5274
+
returnmulticast(newFunc0<Subject<T, T>>() {
5275
+
@Override
5276
+
publicSubject<T, T> call() {
5277
+
returnBehaviorSubject.create(initialValue);
5278
+
}
5279
+
}, selector);
5280
+
}
5281
+
5229
5282
/**
5230
5283
* Returns a {@link ConnectableObservable} that emits only the last item
5231
5284
* emitted by the source Observable.
@@ -5238,6 +5291,30 @@ public ConnectableObservable<T> publish() {
0 commit comments