Skip to content

Commit

Permalink
use Java Subject<T, R> as contravariant in T and covariant in R
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgruetter committed Sep 17, 2013
1 parent 41c91fb commit ac26e42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rxjava-core/src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public Subscription subscribe(final Action1<? super T> onNext, final Action1<Thr
* @return a {@link ConnectableObservable} that upon connection causes the source Observable to
* push results into the specified {@link Subject}
*/
public <R> ConnectableObservable<R> multicast(Subject<T, R> subject) {
public <R> ConnectableObservable<R> multicast(Subject<? super T, ? extends R> subject) {
return OperationMulticast.multicast(this, subject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
import rx.subjects.Subject;

public class OperationMulticast {
public static <T, R> ConnectableObservable<R> multicast(Observable<? extends T> source, final Subject<T, R> subject) {
public static <T, R> ConnectableObservable<R> multicast(Observable<? extends T> source, final Subject<? super T, ? extends R> subject) {
return new MulticastConnectableObservable<T, R>(source, subject);
}

private static class MulticastConnectableObservable<T, R> extends ConnectableObservable<R> {
private final Object lock = new Object();

private final Observable<? extends T> source;
private final Subject<T, R> subject;
private final Subject<? super T, ? extends R> subject;

private Subscription subscription;

public MulticastConnectableObservable(Observable<? extends T> source, final Subject<T, R> subject) {
public MulticastConnectableObservable(Observable<? extends T> source, final Subject<? super T, ? extends R> subject) {
super(new OnSubscribeFunc<R>() {
@Override
public Subscription onSubscribe(Observer<? super R> observer) {
Expand Down

0 comments on commit ac26e42

Please sign in to comment.