public static void main(String[] args) {
ConnectableObservable<String> producer = Observable.just("Hello World 100").publish();
Observable<String> hi = producer.map(String::toUpperCase);
Observable<String> lo = producer.map(String::toLowerCase);
Observable<String> no100 = producer.filter(s -> s.contains("100")).map(s -> s.replace("100", "1000"));
Observable<String> combined = Observable.merge(lo, hi, no100);
combined.subscribe(System.out::println);
// Only emit from the producer when connect() is called.
producer.connect();
}
Last active
April 26, 2017 18:41
-
-
Save tsujeeth/addf603f31e24abb68d4edaf1e61502f to your computer and use it in GitHub Desktop.
Instead of replay, use a connectable observable
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment