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.