user3762200 user3762200 - 1 year ago 508
Java Question

How to use RxJava combineLatest operator with more than 9 observables

I'm using RxJava and I want to combine 12 different observables using the operator


I saw a function prototype that takes a list of observables and an implementation of
but I'm not sure how to do this, I'm having trouble implementing the

Can someone show me an example?

Answer Source

There is a combineLatest that takes a List of observables. Here's an example on how to use it:

List<Observable<?>> list = Arrays.asList(Observable.just(1), Observable.just("2"));
Observable.combineLatest(list, new FuncN<String>() {
    public String call(Object... args) {
        String concat = "";
        for (Object value : args) {
            if (value instanceof Integer) {
                concat += (Integer) value;
            } else if (value instanceof String) {
                concat += (String) value;
        return concat;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download