Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaushikgopal/1f1a3aa37774ebe3032d to your computer and use it in GitHub Desktop.
Save kaushikgopal/1f1a3aa37774ebe3032d to your computer and use it in GitHub Desktop.
snippet hack to make share operator hot
storeObservable =
Observable.interval(1, TimeUnit.SECONDS)
.map(new Func1<Long, Integer>() {
@Override
public Integer call(Long aLong) {
return aLong.intValue();
}
})
.take(20)
.share();
// Do not do this in production!
// this is a hack!
storeObservable = storeObservable.subscribe();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment