Skip to content

Instantly share code, notes, and snippets.

@jwkidd3
Created January 18, 2017 22:14
Show Gist options
  • Save jwkidd3/8630ea4db84ed419db7d4a6144800ba4 to your computer and use it in GitHub Desktop.
Save jwkidd3/8630ea4db84ed419db7d4a6144800ba4 to your computer and use it in GitHub Desktop.
Observable.create(o -> {
System.out.println("Created on " + Thread.currentThread().getId());
o.onNext(1);
o.onNext(2);
o.onCompleted();
})
.doOnNext(i ->
System.out.println("Before " + i + " on " + Thread.currentThread().getId()))
.observeOn(Schedulers.newThread())
.doOnNext(i ->
System.out.println("After " + i + " on " + Thread.currentThread().getId()))
.subscribe();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment