One can notice pretty fast that the rate the Twitter status updates are received at is really fast. To make the UI a little less overcrowded, we can add a simple .sample() method to reduce its rate:
observeTwitterStream(configuration, filterQuery) .sample(700, TimeUnit.MILLISECONDS) .map(StockUpdate::create)
With the following line, we make the TwitterStream Observable output an entry every 700 ms instead of flushing everything it receives:
Obviously, this way we are losing some data, but for the sake of the exercise, it is a useful approach to cope with the data that keeps overflowing the UI.
Now, another problem is that the stream quickly leaves the user in the current scroll position, ...