RxJava
RxJava copied to clipboard
how to use Action2-Action9?
like this ,
Action2<Integer,String> action2= (i,.s) ->{
System.out.println(i);
System.out.println(s);
}
,how to subscribe this Action2?
Observable.just(2,"test").subscribe( ) ,this only Action1
I want to pass two or three different argument,how can i do this?
You can't do that in RxJava. There are projects that experiment multi-valued Observables: https://github.com/stealthcode/RxJavaMulti for example.
I don't know exactly what you are after but you could also do this:
Observable.just(1, "hello", 2, "there")
.buffer(2)
.subscribe(list -> { doSomethingWithTheList(list);});
The lambda is Action1<List<Object>>.
I think the question was answered. Closing.