Skip to content

Implemented Most Recent#168

Merged
benjchristensen merged 3 commits intoReactiveX:masterfrom
mairbek:mostrecent
Mar 11, 2013
Merged

Implemented Most Recent#168
benjchristensen merged 3 commits intoReactiveX:masterfrom
mairbek:mostrecent

Conversation

@mairbek
Copy link
Contributor

@mairbek mairbek commented Mar 4, 2013

For issue #64.

@cloudbees-pull-request-builder

RxJava-pull-requests #6 SUCCESS
This pull request looks good

@benjchristensen
Copy link
Member

Man it is hard to understand the difference between Latest, Next, MostRecent etc using MSDN docs ...

@benjchristensen
Copy link
Member

Trying to figure out the difference between Observable.Latest (http://msdn.microsoft.com/en-us/library/hh212115(v=vs.103).aspx) and Observable.MostRecent (http://msdn.microsoft.com/en-us/library/hh229751(v=vs.103).aspx) other than the latter having an initialValue.

Both return IEnumerable<TSource> and both say "Samples the most recent value in an observable sequence."

The Observable.Next operator says "Samples the next value (blocking without buffering) from in an observable sequence." and also returns IEnumerable<TSource>.

@benjchristensen
Copy link
Member

My understanding of these operators are:

  • Latest
    • will cache the latest value and return immediately when iterator.next() is called
    • or block if no value is cached until next value
    • when the value is emitted it is removed from the cache so only emitted once
  • Next
    • will not cache the latest value so will block until next value
  • MostRecent
    • will cache the latest value and return immediately when iterator.next() is called
    • or block if no value is cached until next value
    • the last value is always retained so if you subscribe to it multiple times it will keep returning the "most recent" value
    • the initialValue guarantees it will never wait and immediately return

@benjchristensen
Copy link
Member

This pull request looks good ... merging.

benjchristensen added a commit that referenced this pull request Mar 11, 2013
@benjchristensen benjchristensen merged commit c3ff753 into ReactiveX:master Mar 11, 2013
rickbw pushed a commit to rickbw/RxJava that referenced this pull request Jan 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants