Exemplo n.º 1
0
        public static IPromiseEnumerator <IPromiseGrouping <TKey, TValue> > GroupBy <T, TKey, TValue>(
            IPromiseEnumerator <T> items,
            Func <T, int, IPromise <TKey> > key,
            Func <T, int, IPromise <TValue> > value,
            IEqualityComparer <TKey> comparer)
        {
            var tuples = SelectEnumerator.Create(items, (item, index) => key(item, index).Then(k => value(item, index).Then(v => Tuple.Create(k, v))));
            var keys   = DistinctEnumerator.Create(SelectEnumerator.Create(tuples, x => x.Item1));

            return(SelectEnumerator.Create(keys, k => (IPromiseGrouping <TKey, TValue>)(new PromiseGrouping <T, TKey, TValue>(k, tuples, comparer))));
        }
Exemplo n.º 2
0
 public static IPromiseEnumerator <T> Union <T>(IPromiseEnumerator <T> left, IPromiseEnumerator <T> right, IEqualityComparer <T> comparer)
 {
     return(DistinctEnumerator.Create(ConcatEnumerator.Create(left, right), comparer));
 }
Exemplo n.º 3
0
 public static IPromiseEnumerator <T> Union <T>(IPromiseEnumerator <T> left, IPromiseEnumerator <T> right)
 {
     return(DistinctEnumerator.Create(ConcatEnumerator.Create(left, right)));
 }