package io.github.suzp1984.rx.demos;

import rx.Observable;

/**
 * Created by jacobsu on 3/24/16.
 */
public class ObservableTransformingRunner implements IRxRunner {
    @Override
    public void run() {
        System.out.println("--- Observable buffer ---");
        Observable.range(1, 10).buffer(2).subscribe(x -> System.out.println(x),
                x -> System.out.println(x.toString()),
                () -> System.out.println("completed"));
    }
}

@@ -446,16 +446,764 @@
 eted%22));
+%0A%0A        System.out.println(%22--- Observable flatmap ---%22);%0A        Observable.range(1, 10).flatMap(x -%3E %7B%0A                    return Observable.just(x * x);%0A                %7D%0A        ).subscribe(x -%3E System.out.println(x),%0A                x -%3E System.out.println(x.toString()),%0A                () -%3E System.out.println(%22completed%22));%0A%0A        System.out.println(%22--- Observable concatmap ---%22);%0A        Observable.range(1, 10).concatMap(x -%3E %7B%0A            return Observable.just(x * x);%0A        %7D).subscribe(x -%3E System.out.println(x),%0A                x -%3E System.out.println(x.toString()),%0A                () -%3E System.out.println(%22completed%22));%0A%0A%0A        System.out.println(%22--- Observable groupby ---%22);%0A        // Observable.range(1, 10).group
 %0A    %7D%0A%7D

add observable flatmap and concatmap samples