Esempio n. 1
0
 public override IPublisher <int> CreatePublisher(long elements)
 {
     return(Flowable.Range(1, (int)elements)
            .FlatMap(v => v == 1 ? Flowable.Just(v) : Flowable.FromArray(v, v - 1))
            .Distinct()
            .Filter(v => true));
 }
 public void Normal()
 {
     Flowable.FromArray(1, 2, 2, 3, 3, 4, 4, 5, 5, 6)
     .DistinctUntilChanged()
     .Test()
     .AssertResult(1, 2, 3, 4, 5, 6);
 }
 public void NormalConditional()
 {
     Flowable.FromArray(1, 2, 2, 3, 3, 4, 4, 5, 5, 6)
     .DistinctUntilChanged()
     .Filter(v => true)
     .Test()
     .AssertResult(1, 2, 3, 4, 5, 6);
 }
Esempio n. 4
0
 public override IPublisher <int> CreatePublisher(long elements)
 {
     int[] a = new int[(int)elements];
     for (int i = 0; i < a.Length; i++)
     {
         a[i] = i;
     }
     return(Flowable.FromArray(a).Filter(v => true));
 }
Esempio n. 5
0
        public void GroupByPublish()
        {
            var published = Flowable.FromArray("A", "AB", "BC")
                            .GroupBy(x => x.Length)
                            .Publish();

            published.Subscribe(g =>
            {
                Console.WriteLine(g.Key);
            });

            published.Connect();
        }
Esempio n. 6
0
 public static ICompletable MergeDelayError(this ICompletable[] sources, int maxConcurrency = int.MaxValue)
 {
     return(Flowable.FromArray(sources).FlatMap(c => c.ToPublisher <object>(), true, maxConcurrency).ToCompletable());
 }
Esempio n. 7
0
 public static IPublisher <T> MergeDelayError <T>(this ISingle <T>[] sources, int maxConcurrency = int.MaxValue)
 {
     return(Flowable.FromArray(sources).FlatMap(s => s.ToPublisher(), true, maxConcurrency));
 }
Esempio n. 8
0
 public static IPublisher <T> Concat <T>(this ISingle <T>[] sources)
 {
     return(Flowable.FromArray(sources).ConcatMap(s => s.ToPublisher()));
 }