Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.x: count, elementAt, ingoreElements, last, single, reduce, reduceWith to return non-Flowable #4576

Merged
merged 1 commit into from
Sep 22, 2016

Conversation

akarnokd
Copy link
Member

This PR updates many Flowable operators to return Single, Maybe or Completable:

  • count() -> Single
  • elementAt() -> Maybe
  • elementAt(T) -> Single
  • first(T) -> Single
  • firstElement() -> Maybe
  • ignoreElements() -> Completable
  • reduce(Callable, BiFunction) -> Single
  • reduceWith(U, BiFunction) -> Single
  • single(T) -> Single
  • singleElement() -> Maybe

and deletes Flowable.toSingle, Flowable.toMaybe and Flowable.toCompletable.

Flowble.reduce(BiFunction) was not yet changed from Single to Maybe (to allow empty sources to be reduced to empty Maybe).

Related: #4321

@akarnokd akarnokd added this to the 2.0 RC 3 milestone Sep 21, 2016
@codecov-io
Copy link

Current coverage is 78.42% (diff: 77.05%)

Merging #4576 into 2.x will decrease coverage by 0.17%

@@                2.x      #4576   diff @@
==========================================
  Files           538        545     +7   
  Lines         35686      35941   +255   
  Methods           0          0          
  Messages          0          0          
  Branches       5516       5548    +32   
==========================================
+ Hits          28049      28185   +136   
- Misses         5634       5737   +103   
- Partials       2003       2019    +16   

Powered by Codecov. Last update 71ddf4b...d2611b0

public final Flowable<T> first() {
return take(1).single();
public final Maybe<T> firstElement() {
return elementAt(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@akarnokd akarnokd merged commit 470eddb into ReactiveX:2.x Sep 22, 2016
@akarnokd akarnokd deleted the MoreSingleReturns_3 branch September 22, 2016 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants