Created
February 20, 2017 23:05
-
-
Save invasionofsmallcubes/80f36a2b15af2767aec291cb6ab05d50 to your computer and use it in GitHub Desktop.
Page 102 of your book
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Question is totally stupid but... | |
// Example on the book: | |
Observable<Observable<String>> delay = just( | |
alice.map(w -> "MOO Alice: " + w), | |
paolo.map(w -> "MOO Paolo: " + w), | |
carmelo.map(w -> "MOO Carmelo: " + w) | |
) | |
.flatMap(Observable::just) | |
.delay(random.nextInt(5), SECONDS); | |
// what is the difference with: | |
Observable<Observable<String>> delay = just( | |
alice.map(w -> "MOO Alice: " + w), | |
paolo.map(w -> "MOO Paolo: " + w), | |
carmelo.map(w -> "MOO Carmelo: " + w) | |
) | |
.delay(random.nextInt(5), SECONDS); | |
// Running with | |
switchOnNext(delay).subscribe(out::println); | |
// gives the same results... | |
// why using the flatMap? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment