Double trigger livedata transformation

A replacement for the mediator LiveData for triggering LiveData transformations.


Sample code:

val isTriggered: LiveData<Boolean> = Transformations.switchMap(
            myTriggerA,     // will be triggered when response A arrives from the API
            myTriggerB      // will be triggered when response B arrives from the API
    ) {
        // When we'll have the data from both of the calls, we can continue:
        if (it.first != null && it.second != null) {
            doSomething(it.first, it.second)
        } else {

This assumes the AbsentLiveData class to exist, to be used when neither A or B yields results.