Observables only emit one object, so doOnNext()
is always called with an Action1
. How can I use Action2
in a similar fashion?
Can I combine 2 observables call an Action2
?
EDIT: Why would I want to do this? I am working on a checkout app. I have a view that in order to display correctly, it needs two pieces of data (1: tip% and 2: total cost). So if this view could react to an observable sequence as an Action2
, I would be happy.
EDIT2: Here's a method on the view mentioned previously. If this were an Action1
, I could easily call it like I do with .doOnNext()
. Are there operators that can operate similarly to .doOnNext()
but take in an Action2
as a parameter? Maybe something like withLatestFrom()
that takes in an Action2
instead of a Func2
?
public Action2<Money, List<Integer>> displayGratuityOptions() {
return (subtotal, gratuityPercents) -> {
removeAllTabs();
for (final Integer percent : gratuityPercents) {
addTab(createTab(subtotal, percent));
}
addTab(createCustomGratuityTab());
};
}