@@ -20,7 +20,6 @@ package rx.lang.scala
2020import org .scalatest .junit .JUnitSuite
2121import scala .collection .Seq
2222import rx .lang .scala .observables .BlockingObservable
23- import rx .lang .scala .observables .ConnectableObservable
2423
2524
2625/**
@@ -38,6 +37,7 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
3837 import rx .util .functions ._
3938 import rx .lang .scala .{Notification , Subscription , Scheduler , Observer }
4039 import rx .lang .scala .util ._
40+ import rx .lang .scala .subjects .Subject
4141 import rx .lang .scala .ImplicitFunctionConversions ._
4242
4343 /**
@@ -132,11 +132,13 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
132132 * into
133133 * @param <R>
134134 * result type
135- * @return a {@link ConnectableObservable} that upon connection causes the source Observable to
136- * push results into the specified {@link Subject}
135+ * @return a pair of a start function and an {@link Observable} such that when the start function
136+ * is called, the Observable starts to push results into the specified {@link Subject}
137137 */
138- // public <R> ConnectableObservable<R> multicast(Subject<T, R> subject) TODO
139-
138+ def multicast [R ](subject : Subject [T , R ]): (() => Subscription , Observable [R ]) = {
139+ val javaCO = asJava.multicast[R ](subject)
140+ (() => javaCO.connect(), Observable [R ](javaCO))
141+ }
140142
141143 /**
142144 * Returns an Observable that first emits the items emitted by this, and then the items emitted
@@ -904,11 +906,12 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
904906 * <p>
905907 * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/replay.png">
906908 *
907- * @return a {@link ConnectableObservable} that upon connection causes the source Observable to
908- * emit items to its {@link Observer}s
909+ * @return a pair of a start function and an {@link Observable} such that when the start function
910+ * is called, the Observable starts to emit items to its {@link Observer}s
909911 */
910- def replay (): ConnectableObservable [T ] = {
911- new ConnectableObservable [T ](asJava.replay())
912+ def replay (): (() => Subscription , Observable [T ]) = {
913+ val javaCO = asJava.replay()
914+ (() => javaCO.connect(), Observable [T ](javaCO))
912915 }
913916
914917 /**
@@ -937,11 +940,12 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
937940 * <p>
938941 * <img width="640" src="https://github.com/Netflix/RxJava/wiki/images/rx-operators/publishConnect.png">
939942 *
940- * @return a {@link ConnectableObservable} that upon connection causes the source Observable to
941- * emit items to its {@link Observer}s
943+ * @return a pair of a start function and an {@link Observable} such that when the start function
944+ * is called, the Observable starts to emit items to its {@link Observer}s
942945 */
943- def publish : ConnectableObservable [T ] = {
944- new ConnectableObservable [T ](asJava.publish())
946+ def publish : (() => Subscription , Observable [T ]) = {
947+ val javaCO = asJava.publish()
948+ (() => javaCO.connect(), Observable [T ](javaCO))
945949 }
946950
947951 // There is no aggregate function with signature
0 commit comments