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

Converting objects

Finally, since we've decided to use the StockUpdate original class to work in the application, we will have to convert YahooStockQuote into StockUpdate. That can be done simply by the following:

.map(r -> StockUpdate.create(r))

Here, StockUpdate.create(r) is:

public static StockUpdate create(YahooStockQuote r) {    return new StockUpdate(r.getSymbol(), r.getLastTradePriceOnly(),     new Date());}

In the end, we have a transformed the original class of YahooStockQuery, which was unwieldy to work with, into something that we are ready to use further in our code.

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