Implemented the 'any' operator#385
Conversation
|
RxJava-pull-requests #284 SUCCESS |
|
I haven't looked at the first question yet, but on the second one we'll likely need to stop importing |
|
Sorry that I missed the keyword |
|
RxJava-pull-requests #285 ABORTED |
|
I tested the C# I found the description in my VS is I always did some tests for using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reactive.Linq;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var any = Observable.Empty().Any();
any.Subscribe(
x => Console.WriteLine("subscriber got " + x) // subscriber got False
);
any = Observable.Range(1, 5).Any();
any.Subscribe(
x => Console.WriteLine("subscriber got " + x) // subscriber got True
);
any = Observable.Empty().Any(
x => true
);
any.Subscribe(
x => Console.WriteLine("subscriber got " + x) // subscriber got False
);
any = Observable.Range(1, 5).Any(
x => x > 3
);
any.Subscribe(
x => Console.WriteLine("subscriber got " + x) // subscriber got True
);
any = Observable.Range(1, 5).Any(
x => x > 5
);
any.Subscribe(
x => Console.WriteLine("subscriber got " + x) // subscriber got False
);
Console.ReadLine();
}
}
}
Here is the output: subscriber got False subscriber got True subscriber got False subscriber got True subscriber got False In summary,
|
|
I have implemented the correct 'any' operator. Please take a look. Thanks! |
|
RxJava-pull-requests #286 ABORTED |
|
In Scala, we will probably use |
|
@zsxwing I don't have time tonight but will definitely get to this in the near future, thank you for getting involved! |
This implements the operator
Anyfrom #24 in all two variants.However, I encountered two problems.
Updated: the online document http://msdn.microsoft.com/en-us/library/hh211993(v=vs.103).aspx is wrong. See my later discussion.
Another question is if I add the
anymethod torx.Observable<T>, some unit tests will fail as the methodanyinrx.Observable<T>overrides the methodorg.mockito.Matchers.any(java.lang.Class<T>)in some unit tests (e.g.,rx.subjects.ReplaySubject<T>). Do I need to use another method name, or just modify the unit tests? Now theanymethods inrx.Observable<T>are commented out.Thanks.