Skip to content

Instantly share code, notes, and snippets.

@kpradeep12
Created August 25, 2018 02:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kpradeep12/22662bc5b2360617d3ffe3fc3c2f5e08 to your computer and use it in GitHub Desktop.
Observable<Integer> observable = Observable.create(observableEmitter -> { // <1>
System.out.println("Generating numbers");
new Random().ints(10, 0, 5) // <2>
.forEach(i -> {
delay(500); // <3>
observableEmitter.onNext(i); // <4>
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment