title: Can RxJava be used to send messages only to the most recent subscriber?
body: <p>I've been given a requirement that when there are multiple observers, only the most recent subscription should receive messages.  I'll illustrate with sloppy code examples.</p>
  <p><code>val fooDisposable = mostRecentSubscriberObservable.subscribe(this::foo)</code></p>
  <p>Any time <code>mostRecentSubscriberObservable</code> emits an item, <code>foo()</code> is called.</p>
  <p>Now this runs:</p>
  <p><code>val barDisposable = mostRecentSubscriberObservable.subscribe(this::bar)</code></p>
  <p>Now whenever an item is emitted, <code>bar()</code> is called, because <code>barDisposable</code> is the most recent subscriber. <code>foo()</code> is NOT called.</p>
  <p>Now this runs:</p>
  <p><code>barDisposable.dispose()</code></p>
  <p>Now whenever an item is emitted, <code>foo()</code> is called. Now that <code>barDisposable</code> is gone, <code>fooDisposable</code> is the most recent subscriber, and receives the item.</p>
  <p>Short of creating a custom <code>Subject</code> class (which seems rather complex), is there a way to do this - any existing <code>Subject</code> or combination of operators which would accomplish it? I can't seem to find anything like that.</p>