O'Reilly logo

Reactive Android Programming by Tadas Subonis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Settings for financial stock updates

Let's start with the financial stock quote retrieval block. First of all, we will need to retrieve the preferences by calling this:

settings.getMonitoredSymbols()

Next, we will use .switchMap() to pass those symbols to the createFinancialStockUpdateObservable():

.switchMap(symbols -> {    String query = createQuery(symbols);    String env = "store://datatables.org/alltableswithkeys";    return createFinancialStockUpdateObservable(yahooService, query,    env);})

We could have used .flatMap() to get a very similar effect here, but that would not have ended well. The problem with .flatMap() is that whenever the getMonitoredSymbols() produces a new symbol list, it will create a new Observable for financial stock quote ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required