Skip to content

Instantly share code, notes, and snippets.

@jwkidd3
Created January 18, 2017 22:18
Show Gist options
  • Save jwkidd3/3c6853a3efd49ee0302d4e63782f1e26 to your computer and use it in GitHub Desktop.
Save jwkidd3/3c6853a3efd49ee0302d4e63782f1e26 to your computer and use it in GitHub Desktop.
// Produce
Observable<Integer> producer = Observable.create(o -> {
o.onNext(1);
o.onNext(2);
o.onCompleted();
});
// Consume
producer.subscribe(i -> {
try {
Thread.sleep(1000);
System.out.println(i);
} catch (Exception e) { }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment