Skip to content

Instantly share code, notes, and snippets.

@jwkidd3
Created January 18, 2017 21:49
Show Gist options
  • Save jwkidd3/ee8f49035d04306d572ef98483ae989f to your computer and use it in GitHub Desktop.
Save jwkidd3/ee8f49035d04306d572ef98483ae989f to your computer and use it in GitHub Desktop.
Observable<Long> values = Observable.interval(100, TimeUnit.MILLISECONDS);
Subscription subscription = values
.takeWhile(v -> v < 2)
.subscribe(
v -> System.out.println(v),
e -> System.out.println("Error: " + e),
() -> System.out.println("Completed")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment