These are chat archives for ReactiveX/RxJava

Nov 2017
Nov 02 2017 08:46

I'm guessing there is no way preexisting way to accomplish something like this right?

Observable<CustomEvent> events = listen().toCustomEvent();
    .subscribe(result -> {
          //Here result is a user(Cause::getStarter), but what I would really 
         //like is to then do something like.
          CustomEvent event = result;

I run into this kind of issue all the time and end up with very stringy filters.
What I would like is something sorta like this:

BiObservable<String, Integer> test;
    //At this point we have BiObservable<Double, Integer>
    //Now we have BiObservable<Double, String>
    .subscribe((first, second) -> 
          //Will emit when one from both sides is available.

This would make something like this relatively simple:

Observable<CustomEvent> events;
          //BiObservable<CustomEvent, Cause>
          //BiObservable<CustomEvent, User>
         //If one side of the 'pair' gets removed by filter the other side does too.
        .first().subscribe(event -> {
            //Only care about the first side.

However I don't want to figure out how to make something like this possible until I know there is no 'standard' solution.