RxEither { public static <L, R, T> Func1<Either<L, R>, T> joinLazy(Func1<L, T> left, Func1<R, T> right) { return JoinLazy.create(left, right); } private  RxEither(); static Observable<Either<L, R>> left(Observable<L> left); static Observable<Either<L, R>> right(Observable<R> right); static Observable<Either<L, R>> from(Observable<L> left, Observable<R> right); static Func1<Either<L, R>, Boolean> isLeft(); static Func1<Either<L, R>, Boolean> isRight(); static Observable<L> filterLeft(Observable<Either<L, R>> either); static Observable<R> filterRight(Observable<Either<L, R>> either); @Deprecated static Action1<Either<L, R>> foldLazy(Action1<L> left, Action1<R> right); @Deprecated static Func1<Either<L, R>, T> foldLazy(Func1<L, T> left, Func1<R, T> right); static Action1<Either<L, R>> continuedLazy(Action1<L> left, Action1<R> right); static Func1<Either<L, R>, T> joinLazy(Func1<L, T> left, Func1<R, T> right);  }
@Test @SuppressWarnings("unchecked") public void joinLazy() { Action1<EventA> eventAAction = mock(Action1.class); Func1<EventA, EventA> eventAEventAFunc = mock(Func1.class); Func1<EventB, EventA> eventBEventAFunc = mock(Func1.class); when(eventAEventAFunc.call(eventA)).thenReturn(eventA); when(eventBEventAFunc.call(eventB)).thenReturn(eventA); Observable<Either<EventA, EventB>> either = RxEither.from(eventASubject, eventBSubject); either.map(RxEither.joinLazy(eventAEventAFunc, eventBEventAFunc)).subscribe(eventAAction); eventASubject.onNext(eventA); eventBSubject.onNext(eventB); testScheduler.triggerActions(); verify(eventAAction, times(2)).call(eventA); }