package com.nhpatt.rxjava;

import org.junit.Test;
import rx.Observable;
import rx.Subscriber;

public class RxIsALibrary {

    @Test
    public void anObservableEmitsThings() {
        Observable<String> myObs = Observable.just("Hi!");

        Subscriber<String> mySubs = new Subscriber<String>() {
            @Override
            public void onCompleted() {
            }

            @Override
            public void onError(Throwable throwable) {

            }

            @Override
            public void onNext(String s) {
                System.out.println(s);
            }
        };

        myObs.subscribe(mySubs);
    }

}

package com.nhpatt.rxjava;

import org.junit.Test;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action1;

public class RxIsALibrary {

    @Test
    public void anObservableEmitsThings() {
        Observable.just("Hi!").subscribe(System.out::println);
    }

}

simplify subscriber :)