title: Update and retain existing data with RxJava
body: <p>I'm looking into converting some logic in my (Android) app to use RxJava, however I'm struggling to come up with a way to do some more advanced logic.</p>
  
  <p>The use case is as follows: I want to show a kind of Feed to the user. The Feed consists of items from different sources, e.g. messages, articles, etc. Due to API restrictions, the app itself must gather the individual sources and show them in one list.</p>
  
  <p>For example, assume my items in the Feed are as follows:</p>
  
  <pre class="lang-java prettyprint-override"><code>class FeedItem {
       Type feedItem; // Type of the item, e.g. article, message, etc.
       ...
  }
  </code></pre>
  
  <p>Currently, the feed is built on a separate thread, and the UI is notified using a listener when the feed has been updated. To give you an idea of how it's done, below is some (pseudo) Java code (threading and other administrative code is omitted for clarity).</p>
  
  <pre class="lang-java prettyprint-override"><code>class FeedProducer {
      List&lt;FeedItem&gt; currentData = new ArrayList();
  
      public void refreshData() {
          for (FeedSource source: getFeedSources()) {
              Type sourceType = source.getType();
              // Remove existing items
              currentData.removeIf(item -&gt; item.feedItem.equals(sourceType));
              List&lt;FeedItem&gt; newItems = source.produceItems();
              // Add the new items
              currentData.addAll(newItems);
              // Notify the UI things have changed
              notifyDataChanged(currentData);
          }
          // Notify the UI we are done loading
          notifyLoadingComplete();
      }
  }
  </code></pre>
  
  <p>This method <code>refreshData()</code> will be called each time the user wants to refresh the data. This way, it's possible to only update some sources, while others stay the same (e.g. by changing the return value of <code>getFeedSources()</code>).</p>
  
  <p>These sources are also used individually in other parts of the app; I have converted them to Observables there. This made things a lot easier, e.g. if the database changes, the changes are simple pushed to the UI by the Observable.</p>
  
  <p>My question is thus how can I (elegantly) merge these Observable sources into one Observable, but where there is a "global" state of previous results. I have looked into the various combining operators, but have not found what I need. My apologies if I am overlooking something obvious, as I am fairly new to RxJava.</p>