Skip to content

Instantly share code, notes, and snippets.

@caseykulm
Last active August 29, 2015 14:27
Show Gist options
  • Save caseykulm/babf45c6e83bb632c89d to your computer and use it in GitHub Desktop.
Save caseykulm/babf45c6e83bb632c89d to your computer and use it in GitHub Desktop.
How to share one instance of an Observable
ConnectableObservable<Foo> connectableFooObservable = fooObservable.share();
Observable
.combineLatest(connectableFooObservable, obsA, (foo, a) -> { // do something })
.subscribe();
Observable
.combineLatest(connectableFooObservable, obsB, (foo, b) -> { // do something })
.subscribe();
connectableFooObservable.connect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment